/*!
 * maptalks v1.0.0-rc.33
 * LICENSE : BSD-3-Clause
 * (c) 2016-2024 maptalks.org
 */
!function(t, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e((t = t || self).maptalks = {})
}(this, function(t) {
    "use strict";
    var y = {
        isTest: !1,
        idleLog: !1,
        idleTimeRemaining: 8,
        idleForceTimeThreshold: 100,
        idleTimeout: 1e3,
        workerCount: window.MAPTALKS_WORKER_COUNT || 0,
        taskCountPerWorkerMessage: 5
    }
      , g = "_maptalks__internal_layer_"
      , n = ["MultiPoint", "MultiLineString", "MultiPolygon", "GeometryCollection"]
      , h = ["FeatureCollection", "Feature", "Point", "LineString", "Polygon"].concat(n)
      , p = ["markerFile", "polygonPatternFile", "linePatternFile", "markerFillPatternFile", "markerLinePatternFile"]
      , m = [["markerWidth", "markerHeight"], [], [null, "lineWidth"], [], [null, "markerLineWidth"]]
      , r = {
        lineWidth: 1,
        lineOpacity: 1,
        lineDx: 1,
        lineDy: 1,
        polygonOpacity: 1,
        markerWidth: 1,
        markerHeight: 1,
        markerDx: 1,
        markerDy: 1,
        markerOpacity: 1,
        markerFillOpacity: 1,
        markerLineWidth: 1,
        markerLineOpacity: 1,
        textSize: 1,
        textOpacity: 1,
        textHaloRadius: 1,
        textWrapWidth: 1,
        textLineSpacing: 1,
        textDx: 1,
        textDy: 1
    }
      , i = ["lineColor", "polygonFill", "markerFill", "markerLineColor", "textFill"]
      , s = 14;
    function x() {
        return Date.now()
    }
    function F(t) {
        for (var e = 1; e < arguments.length; e++) {
            var i = arguments[e];
            for (var n in i)
                t[n] = i[n]
        }
        return t
    }
    function ut(t) {
        return null == t
    }
    function G(t) {
        return "number" == typeof t && !isNaN(t)
    }
    function c(t) {
        return (0 | t) === t
    }
    function _(t) {
        return "object" == typeof t && !!t
    }
    function P(t) {
        return !ut(t) && ("string" == typeof t || null !== t.constructor && t.constructor === String)
    }
    function H(t) {
        return !ut(t) && ("function" == typeof t || null !== t.constructor && t.constructor === Function)
    }
    var o = Object.prototype.hasOwnProperty;
    function v(t, e) {
        return o.call(t, e)
    }
    var e = Math.PI / 180;
    function w(t) {
        return t * e
    }
    function C(t) {
        return t / e
    }
    var f = "[object process]" === Object.prototype.toString.call("undefined" != typeof process ? process : 0) && !process.versions.electron && !process.versions.nw && !process.versions["node-webkit"]
      , a = {};
    function l() {
        return window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI
    }
    if (!f) {
        var u = navigator.userAgent.toLowerCase()
          , d = document.documentElement || {
            style: {}
        }
          , b = "ActiveXObject"in window
          , M = -1 !== u.indexOf("webkit")
          , T = -1 !== u.indexOf("phantom")
          , S = -1 !== u.search("android [23]")
          , E = -1 !== u.indexOf("chrome")
          , R = -1 !== u.indexOf("gecko") && !M && !window.opera && !b
          , A = /iphone/i.test(u) && /micromessenger/i.test(u)
          , k = "undefined" != typeof orientation || -1 !== u.indexOf("mobile")
          , O = !window.PointerEvent && window.MSPointerEvent
          , L = window.PointerEvent && navigator.pointerEnabled || O
          , D = b && "transition"in d.style
          , I = "WebKitCSSMatrix"in window && "m11"in new window.WebKitCSSMatrix && !S
          , z = "MozPerspective"in d.style
          , j = "OTransition"in d.style
          , B = (D || I || z) && !j && !T
          , N = "undefined" != typeof window && H(window.createImageBitmap)
          , Z = "undefined" != typeof window && H(window.ResizeObserver)
          , W = "undefined" != typeof window && H(window.btoa)
          , V = "undefined" != typeof window && H(window.Proxy)
          , U = "undefined" != typeof window && H(window.requestIdleCallback)
          , J = 0;
        E && (J = u.match(/chrome\/([\d.]+)/)[1]);
        var q = !T && (L || "ontouchstart"in window || window.DocumentTouch && document instanceof window.DocumentTouch)
          , X = "undefined" != typeof window && "WebGLRenderingContext"in window
          , Y = l()
          , Q = !1;
        try {
            new OffscreenCanvas(2,2).getContext("2d"),
            Q = !0
        } catch (t) {
            Q = !1
        }
        var K = !1;
        try {
            window.addEventListener("testPassive", function() {}, {
                get passive() {
                    K = !0
                }
            })
        } catch (t) {}
        a = {
            isTest: !1,
            ie: b,
            ielt9: b && !document.addEventListener,
            edge: "msLaunchUri"in navigator && !("documentMode"in document),
            webkit: M,
            gecko: R,
            android: -1 !== u.indexOf("android"),
            android23: S,
            chrome: E,
            chromeVersion: J,
            safari: !E && -1 !== u.indexOf("safari"),
            phantomjs: T,
            ie3d: D,
            webkit3d: I,
            gecko3d: z,
            opera12: j,
            any3d: B,
            iosWeixin: A,
            mobile: k,
            mobileWebkit: k && M,
            mobileWebkit3d: k && I,
            mobileOpera: k && window.opera,
            mobileGecko: k && R,
            touch: !!q,
            msPointer: !!O,
            pointer: !!L,
            retina: 1 < Y,
            devicePixelRatio: Y,
            language: navigator.browserLanguage ? navigator.browserLanguage : navigator.language,
            ie9: b && 9 === document.documentMode,
            ie10: b && 10 === document.documentMode,
            webgl: X,
            imageBitMap: N,
            resizeObserver: Z,
            btoa: W,
            decodeImageInWorker: Q,
            monitorDPRChange: !0,
            supportsPassive: K,
            proxy: V,
            requestIdleCallback: U,
            checkDevicePixelRatio: function() {
                if ("undefined" != typeof window && a.monitorDPRChange) {
                    var t = l()
                      , e = t !== a.devicePixelRatio;
                    return e && (a.devicePixelRatio = t),
                    e
                }
                return !1
            }
        }
    }
    var $ = a;
    function tt(t, e) {
        for (var i = 0; i < e.length; i++) {
            var n = e[i];
            n.enumerable = n.enumerable || !1,
            n.configurable = !0,
            "value"in n && (n.writable = !0),
            Object.defineProperty(t, (r = n.key,
            void 0,
            "symbol" == typeof (o = function(t, e) {
                if ("object" != typeof t || null === t)
                    return t;
                var i = t[Symbol.toPrimitive];
                if (void 0 !== i) {
                    var n = i.call(t, e || "default");
                    if ("object" != typeof n)
                        return n;
                    throw new TypeError("@@toPrimitive must return a primitive value.")
                }
                return ("string" === e ? String : Number)(t)
            }(r, "string")) ? o : String(o)), n)
        }
        var r, o
    }
    function et() {
        return (et = Object.assign ? Object.assign.bind() : function(t) {
            for (var e = 1; e < arguments.length; e++) {
                var i = arguments[e];
                for (var n in i)
                    Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n])
            }
            return t
        }
        ).apply(this, arguments)
    }
    function it(t, e) {
        t.prototype = Object.create(e.prototype),
        rt(t.prototype.constructor = t, e)
    }
    function nt(t) {
        return (nt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
            return t.__proto__ || Object.getPrototypeOf(t)
        }
        )(t)
    }
    function rt(t, e) {
        return (rt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
            return t.__proto__ = e,
            t
        }
        )(t, e)
    }
    function ot(t, e, i) {
        return (ot = function() {
            if ("undefined" == typeof Reflect || !Reflect.construct)
                return !1;
            if (Reflect.construct.sham)
                return !1;
            if ("function" == typeof Proxy)
                return !0;
            try {
                return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
                !0
            } catch (t) {
                return !1
            }
        }() ? Reflect.construct.bind() : function(t, e, i) {
            var n = [null];
            n.push.apply(n, e);
            var r = new (Function.bind.apply(t, n));
            return i && rt(r, i.prototype),
            r
        }
        ).apply(null, arguments)
    }
    function st(t) {
        var n = "function" == typeof Map ? new Map : void 0;
        return (st = function(t) {
            if (null === t || (e = t,
            -1 === Function.toString.call(e).indexOf("[native code]")))
                return t;
            var e;
            if ("function" != typeof t)
                throw new TypeError("Super expression must either be null or a function");
            if (void 0 !== n) {
                if (n.has(t))
                    return n.get(t);
                n.set(t, i)
            }
            function i() {
                return ot(t, arguments, nt(this).constructor)
            }
            return i.prototype = Object.create(t.prototype, {
                constructor: {
                    value: i,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }),
            rt(i, t)
        }
        )(t)
    }
    function at(t) {
        if (void 0 === t)
            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return t
    }
    var ht, lt, ct = function() {
        function t(t, e, i) {
            if (ut(t) || ut(e) ? ut(t.x) || ut(t.y) ? Array.isArray(t) && (this.x = +t[0],
            this.y = +t[1],
            this.z = t[2]) : (this.x = +t.x,
            this.y = +t.y,
            this.z = t.z) : (this.x = +t,
            this.y = +e,
            this.z = i),
            this._isNaN())
                throw new Error("Position is NaN")
        }
        var e = t.prototype;
        return e.set = function(t, e, i) {
            return this.x = t,
            this.y = e,
            this.z = i || 0,
            this
        }
        ,
        e.abs = function() {
            return new this.constructor(Math.abs(this.x),Math.abs(this.y))
        }
        ,
        e._abs = function() {
            return this.x = Math.abs(this.x),
            this.y = Math.abs(this.y),
            this
        }
        ,
        e._round = function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this
        }
        ,
        e.round = function() {
            return new this.constructor(Math.round(this.x),Math.round(this.y))
        }
        ,
        e._ceil = function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this
        }
        ,
        e.ceil = function() {
            return new this.constructor(Math.ceil(this.x),Math.ceil(this.y))
        }
        ,
        e.distanceTo = function(t) {
            var e = t.x - this.x
              , i = t.y - this.y;
            return Math.sqrt(e * e + i * i)
        }
        ,
        e.mag = function() {
            return Math.sqrt(this.x * this.x + this.y * this.y)
        }
        ,
        e._floor = function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this
        }
        ,
        e.floor = function() {
            return new this.constructor(Math.floor(this.x),Math.floor(this.y))
        }
        ,
        e.copy = function() {
            return new this.constructor(this.x,this.y,this.z)
        }
        ,
        e._add = function(t, e) {
            return ut(t.x) ? ut(t[0]) ? (this.x += t,
            this.y += e) : (this.x += t[0],
            this.y += t[1]) : (this.x += t.x,
            this.y += t.y),
            this
        }
        ,
        e.add = function(t, e) {
            var i, n;
            return ut(t.x) ? ut(t[0]) ? (i = this.x + t,
            n = this.y + e) : (i = this.x + t[0],
            n = this.y + t[1]) : (i = this.x + t.x,
            n = this.y + t.y),
            new this.constructor(i,n)
        }
        ,
        e._sub = function(t, e) {
            return ut(t.x) ? ut(t[0]) ? (this.x -= t,
            this.y -= e) : (this.x -= t[0],
            this.y -= t[1]) : (this.x -= t.x,
            this.y -= t.y),
            this
        }
        ,
        e._substract = function() {
            return this._sub.apply(this, arguments)
        }
        ,
        e.sub = function(t, e) {
            var i, n;
            return ut(t.x) ? ut(t[0]) ? (i = this.x - t,
            n = this.y - e) : (i = this.x - t[0],
            n = this.y - t[1]) : (i = this.x - t.x,
            n = this.y - t.y),
            new this.constructor(i,n)
        }
        ,
        e.substract = function() {
            return this.sub.apply(this, arguments)
        }
        ,
        e.multi = function(t) {
            return new this.constructor(this.x * t,this.y * t)
        }
        ,
        e._multi = function(t) {
            return this.x *= t,
            this.y *= t,
            this
        }
        ,
        e.div = function(t) {
            return this.multi(1 / t)
        }
        ,
        e._div = function(t) {
            return this._multi(1 / t)
        }
        ,
        e.equals = function(t) {
            return t instanceof this.constructor && (this.x === t.x && this.y === t.y && this.z === t.z)
        }
        ,
        e._isNaN = function() {
            return isNaN(this.x) || isNaN(this.y) || G(this.z) && isNaN(this.z)
        }
        ,
        e.isZero = function() {
            return 0 === this.x && 0 === this.y
        }
        ,
        e.toArray = function() {
            return G(this.z) ? [this.x, this.y, this.z] : [this.x, this.y]
        }
        ,
        e.toFixed = function(t) {
            return new this.constructor(this.x.toFixed(t),this.y.toFixed(t),G(this.z) ? this.z.toFixed : void 0)
        }
        ,
        e.toJSON = function() {
            var t = {
                x: this.x,
                y: this.y
            };
            return G(this.z) && (t.z = this.z),
            t
        }
        ,
        t
    }(), dt = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.closeTo = function(t, e) {
            return e || (e = 0),
            this.x >= t.x - e && this.x <= t.x + e && this.y >= t.y - e && this.y <= t.y + e
        }
        ,
        i.mag = function() {
            return Math.sqrt(this.x * this.x + this.y * this.y)
        }
        ,
        i.unit = function() {
            return this.copy()._unit()
        }
        ,
        i._unit = function() {
            return this._div(this.mag()),
            this
        }
        ,
        i.perp = function() {
            return this.copy()._perp()
        }
        ,
        i._perp = function() {
            var t = this.y;
            return this.y = this.x,
            this.x = -t,
            this
        }
        ,
        i.angleWith = function(t) {
            return this.angleWithSep(t.x, t.y)
        }
        ,
        i.angleWithSep = function(t, e) {
            return Math.atan2(this.x * e - this.y * t, this.x * t + this.y * e)
        }
        ,
        i._rotate = function(t) {
            var e = Math.cos(t)
              , i = Math.sin(t)
              , n = e * this.x - i * this.y
              , r = i * this.x + e * this.y;
            return this.x = n,
            this.y = r,
            this
        }
        ,
        i.rotate = function(t) {
            return this.copy()._rotate(t)
        }
        ,
        e
    }(ct);
    function ft(t) {
        var e = "data:image/svg+xml";
        return 4 < t.length && ".svg" === t.slice(-4) ? 1 : t.slice(0, e.length) === e ? 2 : 0
    }
    function gt(t, e) {
        f && gt.node ? gt.node(t, e) : t.src = e[0]
    }
    !function() {
        if (f)
            return ht = function(t) {
                return setTimeout(t, 16)
            }
            ,
            lt = clearTimeout;
        var e, i;
        function t(t) {
            return setTimeout(t, 1e3 / 30)
        }
        function n(t) {
            return window["webkit" + t] || window["moz" + t] || window["ms" + t]
        }
        "undefined" != typeof window ? (e = window.requestAnimationFrame || n("RequestAnimationFrame") || t,
        i = window.cancelAnimationFrame || n("CancelAnimationFrame") || n("CancelRequestAnimationFrame") || function(t) {
            window.clearTimeout(t)
        }
        ) : (e = t,
        i = clearTimeout),
        ht = function(t) {
            return e(t)
        }
        ,
        lt = function(t) {
            t && i(t)
        }
    }();
    var pt = 0;
    function mt() {
        return pt++
    }
    var _t = mt;
    function vt(t) {
        return t && P(t) ? JSON.parse(t) : t
    }
    function yt(t) {
        for (var e = 1; e < arguments.length; e++) {
            var i = arguments[e];
            if (i && i.length)
                for (var n = 0, r = i.length; n < r; n++)
                    t.push(i[n])
        }
        return t.length
    }
    function xt(t, e) {
        var i = e.indexOf(t);
        -1 < i && e.splice(i, 1)
    }
    function wt(t, e, i) {
        if (!Array.isArray(t))
            return i ? e.call(i, t) : e(t);
        for (var n, r, o = [], s = 0, a = t.length; s < a; s++)
            ut(n = t[s]) ? o.push(null) : Array.isArray(n) ? o.push(wt(n, e, i)) : (r = i ? e.call(i, n) : e(n),
            o.push(r));
        return o
    }
    function Ct(t, e) {
        return void 0 === t ? e : t
    }
    function bt(t) {
        return Math.sign ? Math.sign(t) : 0 === (t = +t) || isNaN(t) ? Number(t) : 0 < t ? 1 : -1
    }
    function Pt(t, e, i) {
        return t * (1 - i) + e * i
    }
    function Mt(t, e, i) {
        if (t === i || t === e)
            return t;
        var n = i - e;
        return ((t - e) % n + n) % n + e
    }
    function Tt(t, e, i) {
        return Math.min(i, Math.max(e, t))
    }
    function St(t) {
        return Array.isArray(t) && 0 < t.length
    }
    var Et = /^([a-z][a-z\d+\-.]*:)?\/\//i;
    var Rt = /^url\((['"])(.+)\1\)$/i
      , At = /^url\(([^'"].*[^'"])\)$/i;
    function kt(t) {
        return P(t) ? At.test(t) ? 1 : Rt.test(t) ? 2 : 3 : 0
    }
    function Ot(t) {
        var e = kt(t);
        return 3 === e ? t : 1 === e ? At.exec(t)[1] : 2 === e ? Rt.exec(t)[2] : t
    }
    var Lt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function Dt(t) {
        if ($.btoa)
            return window.btoa(t);
        for (var e, i, n = String(t), r = "", o = 0, s = Lt; n.charAt(0 | o) || (s = "=",
        o % 1); r += s.charAt(63 & e >> 8 - o % 1 * 8)) {
            if (255 < (i = n.charCodeAt(o += .75)))
                throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
            e = e << 8 | i
        }
        return r
    }
    function It(t, e) {
        for (var i = atob(t), n = new ArrayBuffer(i.length), r = new Uint8Array(n), o = 0; o < i.length; o++)
            r[o] = 255 & i.charCodeAt(o);
        return new Blob([n],{
            type: e
        })
    }
    function zt(t, e, i, n) {
        var r = i - t
          , o = n - e;
        return Math.atan2(o, r)
    }
    var jt = "";
    function Ft(t, e) {
        if (!t && !e)
            return !0;
        if (!t || !e)
            return !1;
        for (var i in t)
            if ("center" === i) {
                if (!e[i] || !Gt(t[i][0], e[i][0]) || !Gt(t[i][1], e[i][1]))
                    return !1
            } else if (t[i] !== e[i])
                return !1;
        return !0
    }
    function Gt(t, e, i) {
        return null == i && (i = 1e-6),
        e - i <= t && t <= e + i
    }
    function Ht(e, i, n, r) {
        e || (e = 100),
        i || (i = 4);
        var o = this
          , s = this.isVisible();
        return i *= 2,
        this._flashTimeout && clearTimeout(this._flashTimeout),
        this._flashTimeout = setTimeout(function t() {
            if (0 === i)
                return s ? o.show() : o.hide(),
                void (n && (r ? n.call(r) : n()));
            i % 2 == 0 ? o.hide() : o.show(),
            i--,
            o._flashTimeout = setTimeout(t, e)
        }, e),
        this
    }
    function Bt(t, e) {
        void 0 === t && (t = []),
        void 0 === e && (e = "_pt");
        for (var i = [], n = 0, r = t.length; n < r; n++) {
            var o = t[n];
            if (o) {
                o[e] || (o[e] = new dt(0,0));
                var s = o[e];
                s.x = 0,
                s.y = 0,
                i.push(s)
            } else
                i.push(null)
        }
        return i
    }
    function Nt(t, e) {
        e(t.data)
    }
    function Zt(t) {
        if (t && 0 === t.indexOf("http://") || 0 === t.indexOf("https://"))
            return t;
        var e = document.createElement("a");
        return e.href = t,
        t = e.href,
        e = null,
        t
    }
    var Wt, Vt = {
        cssWidth: "1px",
        cssHeight: "1px",
        width: 1,
        height: 1
    };
    function Ut(t, e) {
        void 0 === e && (e = 1);
        var i = t.width
          , n = t.height;
        return Vt.cssWidth = i + "px",
        Vt.cssHeight = n + "px",
        Vt.width = Math.round(i * e),
        Vt.height = Math.round(n * e),
        Vt
    }
    var Jt = {
        width: 100,
        height: 10
    };
    var qt, Xt = function() {
        function t(t, e) {
            if (void 0 === e && (e = {}),
            Array.isArray(t))
                if (t.length < 2)
                    console.error("colors.length should >1");
                else {
                    for (var i = 1 / 0, n = -1 / 0, r = 0, o = (this.colors = t).length; r < o; r++) {
                        var s = t[r][0];
                        i = Math.min(s, i),
                        n = Math.max(s, n)
                    }
                    this.min = i,
                    this.max = n,
                    this.valueOffset = this.max - this.min,
                    this.options = Object.assign({}, Jt, e),
                    this._initImgData()
                }
            else
                console.error("colors is not array")
        }
        var e = t.prototype;
        return e.getImageData = function() {
            return this.imgData
        }
        ,
        e._initImgData = function() {
            var t = function() {
                if (!Wt) {
                    var t = Jt.width
                      , e = Jt.height;
                    OffscreenCanvas ? Wt = new OffscreenCanvas(t,e) : ((Wt = document.createElement("canvas")).width = t,
                    Wt.height = e)
                }
                return Wt
            }()
              , e = this.options
              , i = e.width
              , n = e.height;
            t.width = i,
            t.height = n;
            var r = t.getContext("2d");
            r.clearRect(0, 0, t.width, t.height);
            for (var o = r.createLinearGradient(0, 0, t.width, 0), s = this.colors, a = this.valueOffset, h = 0, l = s.length; h < l; h++) {
                var u = s[h]
                  , c = u[0]
                  , d = u[1]
                  , f = (c - this.min) / a;
                o.addColorStop(f, d)
            }
            r.fillStyle = o,
            r.fillRect(0, 0, t.width, t.height),
            this.imgData = r.getImageData(0, 0, t.width, t.height)
        }
        ,
        e.getColor = function(t) {
            t = Math.max(this.min, t);
            var e = ((t = Math.min(t, this.max)) - this.min) / this.valueOffset
              , i = Math.round(e * this.imgData.width)
              , n = 4 * (i = Math.min(i, this.imgData.width - 1));
            return [this.imgData.data[n], this.imgData.data[n + 1], this.imgData.data[n + 2], this.imgData.data[n + 3]]
        }
        ,
        t
    }();
    function Yt(t, e) {
        for (var i = 0; i < t.stops.length; i++)
            if (e === t.stops[i][0])
                return t.stops[i][1];
        return t.default
    }
    function Qt(t, e) {
        for (var i = 0; i < t.stops.length && !(e < t.stops[i][0]); i++)
            ;
        return t.stops[Math.max(i - 1, 0)][1]
    }
    function Kt(t, e) {
        for (var i = void 0 !== t.base ? t.base : 1, n = 0; !(n >= t.stops.length || e <= t.stops[n][0]); )
            n++;
        return 0 === n ? t.stops[n][1] : n === t.stops.length ? t.stops[n - 1][1] : function i(n, r, o, s, a, h) {
            return "function" == typeof a ? function() {
                var t = a.apply(void 0, arguments)
                  , e = h.apply(void 0, arguments);
                return i(n, r, o, s, t, e)
            }
            : a.length ? function(t, e, i, n, r, o) {
                for (var s = [], a = 0; a < r.length; a++)
                    s[a] = ie(t, e, i, n, r[a], o[a]);
                return s
            }(n, r, o, s, a, h) : ie(n, r, o, s, a, h)
        }(e, i, t.stops[n - 1][0], t.stops[n][0], t.stops[n - 1][1], t.stops[n][1])
    }
    "function" == typeof Map && (qt = new Map);
    var $t = {
        width: 100,
        height: 1
    };
    function te(t, e) {
        var i = t.stops;
        if (i && 1 < i.length) {
            var n;
            if (qt) {
                var r = JSON.stringify(i);
                if (!qt.has(r)) {
                    var o = new Xt(i,$t);
                    qt.set(r, o)
                }
                n = qt.get(r)
            } else
                n = new Xt(i,$t);
            var s = n.getColor(e);
            return [s[0] / 255, s[1] / 255, s[2] / 255, s[3] / 255]
        }
        return i && 1 === i.length ? i[0][1] : null
    }
    function ee(t, e) {
        return i = e,
        n = t.default,
        void 0 !== i ? i : void 0 !== n ? n : void 0 !== r ? r : null;
        var i, n, r
    }
    function ie(t, e, i, n, r, o) {
        var s, a = n - i, h = t - i;
        return r * (1 - (s = 1 === e ? h / a : (Math.pow(e, h) - 1) / (Math.pow(e, a) - 1))) + o * s
    }
    function ne(t) {
        return t && "object" == typeof t && (t.stops || t.property && "identity" === t.type)
    }
    function re(t) {
        for (var e in t)
            if (ne(t[e]))
                return !0;
        return !1
    }
    function oe(t) {
        return he(t, "exponential")
    }
    function se(t, i) {
        if (!t)
            return null;
        var e = !1;
        if (Array.isArray(t)) {
            for (var n, r = [], o = 0; o < t.length; o++)
                (n = se(t[o], i)) ? (r.push(n),
                e = !0) : r.push(t[o]);
            return e ? r : t
        }
        var s, a = {
            __fn_types_loaded: !0
        }, h = [];
        for (s in t)
            t.hasOwnProperty(s) && h.push(s);
        for (var l = function(e) {
            Object.defineProperty(a, e, {
                get: function() {
                    return this["__fn_" + e] || (this["__fn_" + e] = oe(this["_" + e])),
                    this["__fn_" + e].apply(this, i())
                },
                set: function(t) {
                    this["_" + e] = t
                },
                configurable: !0,
                enumerable: !0
            })
        }, u = 0, c = h.length; u < c; u++)
            ne(t[s = h[u]]) ? (e = !0,
            a["_" + s] = t[s],
            l(s)) : a[s] = t[s];
        return e ? a : t
    }
    function ae(t) {
        if (!t || !t.stops)
            return [];
        for (var e = [], i = 0, n = t.stops.length; i < n; i++)
            e.push(t.stops[i][1]);
        return e
    }
    function he(t, e) {
        if (!ne(t))
            return function() {
                return t
            }
            ;
        var i = !0
          , n = !0
          , r = (t = JSON.parse(JSON.stringify(t))).stops;
        if (r)
            for (var o = 0; o < r.length; o++)
                if (ne(r[o][1])) {
                    var s = he(r[o][1], e);
                    i = i && s.isZoomConstant,
                    n = n && s.isFeatureConstant,
                    r[o] = [r[o][0], s]
                }
        var a = function t(n, e) {
            var i, r, o;
            if (ne(n)) {
                var s, a = n.stops && "object" == typeof n.stops[0][0], h = a || void 0 !== n.property, l = a || !h, u = n.type || e || "exponential";
                if ("exponential" === u)
                    s = Kt;
                else if ("interval" === u)
                    s = Qt;
                else if ("categorical" === u)
                    s = Yt;
                else if ("identity" === u)
                    s = ee;
                else {
                    if ("color-interpolate" !== u)
                        throw new Error('Unknown function type "' + u + '"');
                    s = te
                }
                if (a) {
                    for (var c = {}, d = [], f = 0; f < n.stops.length; f++) {
                        var g = n.stops[f];
                        void 0 === c[g[0].zoom] && (c[g[0].zoom] = {
                            zoom: g[0].zoom,
                            type: n.type,
                            property: n.property,
                            default: n.default,
                            stops: []
                        }),
                        c[g[0].zoom].stops.push([g[0].value, g[1]])
                    }
                    for (var p in c)
                        d.push([c[p].zoom, t(c[p])]);
                    o = r = !(i = function(t, e) {
                        var i = Kt({
                            stops: d,
                            base: n.base
                        }, t)(t, e);
                        return "function" == typeof i ? i(t, e) : i
                    }
                    )
                } else
                    l ? (i = function(t) {
                        var e = s(n, t);
                        return "function" == typeof e ? e(t) : e
                    }
                    ,
                    o = !(r = !0)) : o = !(r = !(i = function(t, e) {
                        var i = s(n, e ? e[n.property] : null);
                        return "function" == typeof i ? i(t, e) : i
                    }
                    ))
            } else
                i = function() {
                    return n
                }
                ,
                o = r = !0;
            return i.isZoomConstant = o,
            i.isFeatureConstant = r,
            i
        }(t, e);
        return a.isZoomConstant = i && a.isZoomConstant,
        a.isFeatureConstant = n && a.isFeatureConstant,
        a
    }
    var le = ["Unknown", "Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon", "GeometryCollection"];
    function ue(t) {
        return new Function("f","var p = (f && f.properties || {}); return " + ce(t))
    }
    function ce(t) {
        if (!t)
            return "true";
        var e, i, n, r, o = t[0];
        return t.length <= 1 ? "any" === o ? "false" : "true" : "(" + ("==" === o ? fe(t[1], t[2], "===", !1) : "!=" === o ? fe(t[1], t[2], "!==", !1) : "<" === o || ">" === o || "<=" === o || ">=" === o ? fe(t[1], t[2], o, !0) : "any" === o ? pe(t.slice(1), "||") : "all" === o ? pe(t.slice(1), "&&") : "none" === o ? ve(pe(t.slice(1), "||")) : "in" === o ? me(t[1], t.slice(2)) : "!in" === o ? ve(me(t[1], t.slice(2))) : "has" === o ? _e(t[1]) : "!has" === o ? ve(_e(t[1])) : "contains" === o ? (e = t[1],
        i = t[2],
        n = t[3],
        r = de(e),
        void 0 !== n ? "(" + r + " + '').indexOf(\"" + i + '") === ' + n : "(" + r + " + '').indexOf(\"" + i + '") >= 0') : "true") + ")"
    }
    function de(t) {
        return "$" === t[0] ? "f." + t.substring(1) : "p[" + JSON.stringify(t) + "]"
    }
    function fe(t, e, i, n) {
        return "object" == typeof (c = t) && c && t.op ? (o = e,
        s = i,
        a = n,
        h = (r = t).property,
        l = r.op,
        u = de(h),
        "length" !== l ? (console.error("not support " + l + " op"),
        "false") : ge(u = "((" + u + "+='').length)", h, o, s, a)) : ge(de(t), t, e, i, n);
        var r, o, s, a, h, l, u, c
    }
    function ge(t, e, i, n, r) {
        var o = "$type" === e ? le.indexOf(i) : JSON.stringify(i);
        return (r ? "typeof " + t + "=== typeof " + o + "&&" : "") + t + n + o
    }
    function pe(t, e) {
        return t.map(ce).join(e)
    }
    function me(t, e) {
        "$type" === t && (e = e.map(function(t) {
            return le.indexOf(t)
        }));
        var i = JSON.stringify(e.sort(ye))
          , n = de(t);
        return e.length <= 200 ? i + ".indexOf(" + n + ") !== -1" : "function(v, a, i, j) {\n        while (i <= j) { var m = (i + j) >> 1;\n            if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\n        }\n    return false; }(" + n + ", " + i + ",0," + (e.length - 1) + ")"
    }
    function _e(t) {
        return "$id" === t ? '"id" in f' : JSON.stringify(t) + " in p"
    }
    function ve(t) {
        return "!(" + t + ")"
    }
    function ye(t, e) {
        return t < e ? -1 : e < t ? 1 : 0
    }
    function xe(t) {
        var e = t._toJSON()
          , i = e.feature;
        return i.type = le.indexOf(i.geometry.type),
        i.subType = e.subType,
        i
    }
    function we(t) {
        if (!Array.isArray(t))
            return we([t]);
        for (var e = [], i = 0; i < t.length; i++) {
            var n = void 0;
            n = !0 === t[i].filter ? function() {
                return !0
            }
            : ue(t[i].filter),
            e.push(Ce({}, t[i], {
                filter: n
            }))
        }
        return e
    }
    function Ce(t) {
        for (var e = 1; e < arguments.length; e++) {
            var i = arguments[e];
            for (var n in i)
                t[n] = i[n]
        }
        return t
    }
    var be = []
      , Pe = {};
    function Me(t, h) {
        return se(t, function() {
            var t, e, i, n, r, o, s, a = h.getMap();
            return t = be,
            e = a ? a.getZoom() : 12,
            i = F({}, h.getProperties(), (n = Pe,
            r = a && a.getBearing() || 0,
            o = a && a.getPitch() || 0,
            s = a ? a.getZoom() : 10,
            n["{bearing}"] = r,
            n["{pitch}"] = o,
            n["{zoom}"] = s,
            n)),
            t[0] = e,
            t[1] = i,
            t
        })
    }
    var Te = Object.freeze({
        loadGeoSymbol: Me,
        createFilter: ue,
        isFeatureFilter: function t(e) {
            if (!0 === e || !1 === e)
                return !0;
            if (!Array.isArray(e) || 0 === e.length)
                return !1;
            switch (e[0]) {
            case "has":
            case "!has":
                return 2 === e.length && ("string" == typeof e[1] || e[1].property && e[1].op);
            case "in":
            case "!in":
                return 2 <= e.length && ("string" == typeof e[1] || e[1].property && e[1].op);
            case "==":
            case "!=":
            case ">":
            case ">=":
            case "<":
            case "<=":
                return 3 === e.length && ("string" == typeof e[1] || e[1].property && e[1].op);
            case "none":
            case "any":
            case "all":
                var i = e.slice(1)
                  , n = Array.isArray(i)
                  , r = 0;
                for (i = n ? i : i[Symbol.iterator](); ; ) {
                    var o;
                    if (n) {
                        if (r >= i.length)
                            break;
                        o = i[r++]
                    } else {
                        if ((r = i.next()).done)
                            break;
                        o = r.value
                    }
                    var s = o;
                    if (!t(s) && "boolean" != typeof s)
                        return !1
                }
                return !0;
            case "contains":
                return !0;
            default:
                return !1
            }
        },
        getFilterFeature: xe,
        compileStyle: we,
        isFunctionDefinition: ne,
        hasFunctionDefinition: re,
        interpolated: oe,
        piecewiseConstant: function(t) {
            return he(t, "interval")
        },
        loadFunctionTypes: se,
        getFunctionTypeResources: ae
    });
    function Se(t) {
        var e = {
            stroke: {
                stroke: t.markerLineColor,
                "stroke-width": t.markerLineWidth,
                "stroke-opacity": t.markerLineOpacity,
                "stroke-dasharray": null,
                "stroke-linecap": "butt",
                "stroke-linejoin": "round"
            },
            fill: {
                fill: t.markerFill,
                "fill-opacity": t.markerFillOpacity
            }
        };
        return 0 === e.stroke["stroke-width"] && (e.stroke["stroke-opacity"] = 0),
        e
    }
    function Ee(t, e, i) {
        if (!t.markerPath)
            return null;
        var n = 1
          , r = Se(t);
        G(t.markerOpacity) && (n = t.markerOpacity),
        G(t.opacity) && (n *= t.opacity);
        var o = {};
        if (r) {
            for (var s in r.stroke)
                r.stroke.hasOwnProperty(s) && (ut(r.stroke[s]) || (o[s] = r.stroke[s]));
            for (var a in r.fill)
                r.fill.hasOwnProperty(a) && (ut(r.fill[a]) || (o[a] = r.fill[a]))
        }
        for (var h, l = Array.isArray(t.markerPath) ? t.markerPath : [t.markerPath], u = [], c = 0; c < l.length; c++)
            (h = F({}, h = P(l[c]) ? {
                path: l[c]
            } : l[c], o)).d = h.path,
            delete h.path,
            u.push(h);
        var d = ['<svg version="1.1"', 'xmlns="http://www.w3.org/2000/svg"'];
        n < 1 && d.push('opacity="' + n + '"'),
        t.markerPathWidth && t.markerPathHeight && d.push('viewBox="0 0 ' + t.markerPathWidth + " " + t.markerPathHeight + '"'),
        d.push('preserveAspectRatio="none"'),
        e && d.push('width="' + e + '"'),
        i && d.push('height="' + i + '"'),
        d.push("><defs></defs>");
        for (var f = 0; f < u.length; f++) {
            var g = "<path ";
            for (var p in u[f])
                u[f].hasOwnProperty(p) && (g += " " + p + '="' + u[f][p] + '"');
            g += "></path>",
            d.push(g)
        }
        return d.push("</svg>"),
        "data:image/svg+xml;base64," + Dt(d.join(" "))
    }
    function Re(t, e) {
        if (!t)
            return [];
        var i = t;
        Array.isArray(t) || (i = [t]);
        for (var n, r, o, s, a = [], h = p, l = i.length - 1; 0 <= l; l--)
            if (t = i[l]) {
                e && (t = Ae(t));
                for (var u = 0; u < h.length; u++)
                    if (ne(n = t[h[u]]) && (n = ae(n)),
                    n) {
                        Array.isArray(n) || (n = [n]);
                        for (var c = 0; c < n.length; c++)
                            "url(" === n[c].slice(0, 4) && (n[c] = Ot(n[c])),
                            r = m[u],
                            a.push([n[c], t[r[0]], t[r[1]]])
                    }
                if ("path" === t.markerType && t.markerPath)
                    if (o = ne(t.markerWidth) ? 200 : t.markerWidth,
                    s = ne(t.markerHeight) ? 200 : t.markerHeight,
                    ne(t.markerPath)) {
                        n = ae(t.markerPath);
                        for (var d = t.markerPath, f = 0; f < n.length; f++)
                            t.markerPath = n[f],
                            a.push([Ee(t), o, s]);
                        t.markerPath = d
                    } else
                        a.push([Ee(t), o, s])
            }
        return a
    }
    function Ae(t) {
        if (!t)
            return null;
        var e = t;
        if (f)
            return e;
        for (var i, n = p, r = 0, o = n.length; r < o; r++)
            (i = e[n[r]]) && (e[n[r]] = ke(i));
        return e
    }
    function ke(t) {
        if (ne(t) && t.stops) {
            for (var e = t.stops, i = 0; i < e.length; i++)
                e[i][1] = ke(e[i][1]);
            return t
        }
        return "url(" === t.slice(0, 4) && (t = Ot(t)),
        t
    }
    var Oe = function() {
        function r(t, e) {
            G(t) && G(e) ? (this.width = t,
            this.height = e) : G(t.width) ? (this.width = t.width,
            this.height = t.height) : Array.isArray(t) && (this.width = t[0],
            this.height = t[1])
        }
        var t = r.prototype;
        return t.copy = function() {
            return new r(this.width,this.height)
        }
        ,
        t.add = function(t, e) {
            var i, n;
            return t instanceof r ? (i = this.width + t.width,
            n = this.height + t.height) : (i = this.width + t,
            n = this.height + e),
            new r(i,n)
        }
        ,
        t.equals = function(t) {
            return this.width === t.width && this.height === t.height
        }
        ,
        t.multi = function(t) {
            return new r(this.width * t,this.height * t)
        }
        ,
        t._multi = function(t) {
            return this.width *= t,
            this.height *= t,
            this
        }
        ,
        t._round = function() {
            return this.width = Math.round(this.width),
            this.height = Math.round(this.height),
            this
        }
        ,
        t.toPoint = function() {
            return new dt(this.width,this.height)
        }
        ,
        t.toArray = function() {
            return [this.width, this.height]
        }
        ,
        t.toJSON = function() {
            return {
                width: this.width,
                height: this.height
            }
        }
        ,
        r
    }();
    function Le(t) {
        return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "")
    }
    var De = /[\b\t\r\v\f]/gim;
    function Ie(t) {
        return P(t) ? t.replace(De, "") : t
    }
    function ze(t) {
        return Le(t).split(/\s+/)
    }
    var je = "undefined" != typeof document ? document.createElement("canvas").getContext("2d") : null;
    function Fe(t, e) {
        return Fe.node ? Fe.node(t, e) : (je.font = e,
        je.measureText(t).width)
    }
    function Ge(t, e, i) {
        var n = Fe(t, e);
        return new Oe(n,i || s)
    }
    function He(t, e, i, n) {
        if (!t || 0 === t.length)
            return [{
                text: "",
                width: 0
            }];
        var r = ut(n) ? Fe(t, e) : n
          , o = r / t.length
          , s = Math.floor(i / o / 2);
        if (i <= o || s <= 0)
            return [{
                text: "",
                width: i
            }];
        if (r <= i)
            return [{
                text: t,
                width: r
            }];
        for (var a = [], h = t.substring(0, s), l = o * s, u = s, c = t.length; u < c; u++) {
            var d = t[u]
              , f = Fe(h + d);
            i <= f ? (a.push({
                text: h,
                width: l
            }),
            h = t.substring(u, s + u),
            u += s - 1,
            l = o * s) : (h += d,
            l = f),
            c - 1 <= u && (l = Fe(h),
            a.push({
                text: h,
                width: l
            }))
        }
        return a
    }
    var Be = /\{([\w_]+)\}/g;
    function Ne(t, n) {
        return P(t) ? t.replace(Be, function(t, e) {
            if (!n)
                return "";
            var i = n[e];
            return ut(i) ? "" : Array.isArray(i) ? i.join() : i
        }) : t
    }
    function Ze(t, e) {
        G(t) && (t += ""),
        t = t || "";
        var i = e.textMaxHeight || 0
          , n = qe(t, e);
        return i && i < n.size.height && (n.size.height = i),
        n
    }
    function We(t, e, i) {
        var n = t.width
          , r = t.height;
        return new dt("left" === e ? -n : "right" === e ? 0 : -n / 2,"top" === i ? -r : "bottom" === i ? 0 : -r / 2)
    }
    var Ve = "sans-serif"
      , Ue = 14;
    function Je(t) {
        if (t.textFont)
            return t.textFont;
        var e = t.textSize;
        return ut(e) && (e = Ue),
        (t.textStyle && "normal" !== t.textStyle ? t.textStyle + " " : "") + (t.textWeight && "normal" !== t.textWeight ? t.textWeight + " " : "") + e + "px " + (t.textFaceName && function(t) {
            for (var e = t.split(","), i = 0; i < e.length; i++)
                e[i].trim && (e[i] = e[i].trim()),
                0 < e[i].indexOf(" ") && '"' !== e[i][0] && "'" !== e[i][0] && (e[i] = '"' + e[i] + '"');
            return e.join(",")
        }(t.textFaceName) || Ve)
    }
    function qe(t, e) {
        var i = Je(e)
          , n = e.textLineSpacing || 0
          , r = Ge(t, i, e.textSize)
          , o = r.width
          , s = r.height
          , a = e.textWrapCharacter || "\n"
          , h = []
          , l = e.textWrapWidth;
        (!l || o < l) && (l = o),
        P(t) || (t += "");
        var u = 0;
        if (a && 0 <= t.indexOf(a))
            for (var c = t.split(a), d = 0, f = c.length; d < f; d++) {
                var g = c[d]
                  , p = Fe(g, i);
                if (l < p)
                    for (var m = He(g, i, l, p), _ = 0, v = m.length; _ < v; _++) {
                        var y = m[_].width;
                        u < y && (u = y),
                        h.push({
                            text: m[_].text,
                            size: new Oe(y,s)
                        })
                    }
                else
                    u < p && (u = p),
                    h.push({
                        text: g,
                        size: new Oe(p,s)
                    })
            }
        else if (l < o)
            for (var x = He(t, i, l, o), w = 0; w < x.length; w++) {
                var C = x[w].width;
                u < C && (u = C),
                h.push({
                    text: x[w].text,
                    size: new Oe(C,s)
                })
            }
        else
            u < o && (u = o),
            h.push({
                text: t,
                size: r
            });
        var b = h.length;
        return {
            total: b,
            size: new Oe(u,s * b + n * (b - 1)),
            rows: h,
            rawSize: r
        }
    }
    function Xe(t) {
        var e = 0
          , i = t && t.length || 0;
        if (!i)
            return e;
        for (var n = 0; n < i; n++)
            e = (e << 5) - e + t.charCodeAt(n),
            e &= e;
        return e
    }
    var Ye = Object.freeze({
        trim: Le,
        escapeSpecialChars: Ie,
        splitWords: ze,
        stringWidth: Fe,
        stringLength: Ge,
        splitContent: He,
        CONTENT_EXPRE: Be,
        replaceVariable: Ne,
        describeText: Ze,
        getAlignPoint: We,
        DEFAULT_FONT: Ve,
        DEFAULT_TEXTSIZE: Ue,
        getFont: Je,
        splitTextToRow: qe,
        hashCode: Xe
    });
    function Qe(t) {
        return t && t.colorStops
    }
    function Ke(t) {
        var e = [t.type];
        if (t.places && e.push(t.places.join()),
        t.colorStops) {
            for (var i = [], n = t.colorStops.length - 1; 0 <= n; n--)
                i.push(t.colorStops[n].join());
            e.push(i.join(","))
        }
        return e.join("_")
    }
    function $e(i, n) {
        if (!i)
            return 1;
        var t = [];
        if (Array.isArray(i)) {
            for (var e = 0; e < i.length; e++)
                t.push($e(i[e], n));
            return t.sort().join(",")
        }
        var r = Object.keys(i).sort().reduce(function(t, e) {
            return n && 0 !== e.indexOf(n) || (t[e] = i[e]),
            t
        }, {});
        return Xe(JSON.stringify(r))
    }
    function ti(t, e) {
        function i(t, e) {
            ut(t.opacity) ? t.opacity = e : t.opacity *= e
        }
        var n;
        if (Array.isArray(t)) {
            n = [];
            for (var r = 0; r < t.length; r++) {
                var o = F({}, t[r]);
                i(o, e),
                n.push(o)
            }
        } else
            i(n = F({}, t), e);
        return n
    }
    function ei(t) {
        var e = Array.prototype.slice.call(arguments, 1);
        if (e && e.length || (e = [{}]),
        Array.isArray(t)) {
            for (var i, n, r = [], o = 0, s = t.length; o < s; o++) {
                i = t[o],
                n = {};
                for (var a = 0, h = e.length; a < h; a++)
                    Array.isArray(e[a]) ? ut(e[a][o]) ? F(n, i || {}) : F(n, i, e[a][o]) : F(n, i, e[a] ? e[a] : {});
                r.push(n)
            }
            return r
        }
        var l = [{}, t];
        return l.push.apply(l, e),
        F.apply(this, l)
    }
    function ii(t) {
        if (t.symbol && (t = [t]),
        Array.isArray(t))
            return t;
        var e = t.$root
          , i = t.$iconset;
        if (t = t.style,
        e || i) {
            e && "/" === e[e.length - 1] && (e = e.substring(0, e.length - 1)),
            i && "/" === i[i.length - 1] && (i = i.substring(0, i.length - 1));
            ni(t, function(t) {
                return "{$root}" === t ? e : "{$iconset}" === t ? i : null
            })
        }
        return t
    }
    function ni(t, e) {
        for (var i = 0; i < t.length; i++) {
            var n = t[i].symbol;
            n && oi(n, e)
        }
    }
    var ri = /(\{\$root\}|\{\$iconset\})/g;
    function oi(t, e) {
        for (var i in t)
            t.hasOwnProperty(i) && "textName" !== i && (P(t[i]) && 2 < t[i].length ? t[i] = t[i].replace(ri, e) : ne(t[i]) ? t[i] = si(t[i], e) : _(t[i]) && oi(t[i], e))
    }
    function si(t, e) {
        var i = t.default;
        P(i) && (t.default = i.replace(ri, e));
        var n = t.stops;
        if (!n)
            return t;
        for (var r = 0; r < n.length; r++)
            Array.isArray(n[r]) && (P(n[r][1]) ? n[r][1] = n[r][1].replace(ri, e) : ne(n[r][1]) && (n[r][1] = si(n[r][1], e)));
        return t
    }
    function ai(t) {
        void 0 === t && (t = []),
        Array.isArray(t) || (t = [t]);
        for (var e = t.length, i = 0; i < e; i++) {
            var n = t[i];
            if (n.style) {
                var r = n.style
                  , o = r.lineDasharray
                  , s = r.lineWidth;
                if (s && G(s) && 0 < s && o && Array.isArray(o) && o.length)
                    return !0
            }
        }
        return !1
    }
    var hi = Object.freeze({
        now: x,
        extend: F,
        isNil: ut,
        isNumber: G,
        isInteger: c,
        isObject: _,
        isString: P,
        isFunction: H,
        hasOwn: v,
        join: function(t, e) {
            return t.join ? t.join(e || ",") : Array.prototype.join.call(t, e || ",")
        },
        isEmpty: function(t) {
            var e;
            for (e in t)
                return !1;
            return !e
        },
        toRadian: w,
        toDegree: C,
        IS_NODE: f,
        get requestAnimFrame() {
            return ht
        },
        get cancelAnimFrame() {
            return lt
        },
        isSVG: ft,
        loadImage: gt,
        UID: mt,
        GUID: _t,
        parseJSON: vt,
        pushIn: yt,
        removeFromArray: xt,
        forEachCoord: wt,
        getValueOrDefault: Ct,
        sign: bt,
        log2: function(t) {
            if (Math.log2)
                return Math.log2(t);
            var e = Math.log(t) * Math.LOG2E
              , i = Math.round(e);
            return Math.abs(i - e) < 1e-14 ? i : e
        },
        interpolate: Pt,
        wrap: Mt,
        clamp: Tt,
        isArrayHasData: St,
        isURL: function(t) {
            return Et.test(t)
        },
        isCssUrl: kt,
        extractCssUrl: Ot,
        btoa: Dt,
        b64toBlob: It,
        computeDegree: zt,
        emptyImageUrl: jt,
        equalMapView: Ft,
        flash: Ht,
        _defaults: function(t, e) {
            for (var i = Object.getOwnPropertyNames(e), n = 0; n < i.length; n++) {
                var r = i[n]
                  , o = Object.getOwnPropertyDescriptor(e, r);
                o && o.configurable && void 0 === t[r] && Object.defineProperty(t, r, o)
            }
            return t
        },
        getPointsResultPts: Bt,
        getImageBitMap: Nt,
        getAbsoluteURL: Zt,
        calCanvasSize: Ut,
        translateToSVGStyles: Se,
        getMarkerPathBase64: Ee,
        getExternalResources: Re,
        convertResourceUrl: Ae,
        isGradient: Qe,
        getGradientStamp: Ke,
        getSymbolStamp: function(t, e) {
            return $e(t, e)
        },
        getSymbolHash: $e,
        lowerSymbolOpacity: ti,
        extendSymbol: ei,
        parseStyleRootPath: ii,
        convertStylePath: ni,
        parseSymbolPath: oi,
        isDashLine: ai,
        trim: Le,
        escapeSpecialChars: Ie,
        splitWords: ze,
        stringWidth: Fe,
        stringLength: Ge,
        splitContent: He,
        CONTENT_EXPRE: Be,
        replaceVariable: Ne,
        describeText: Ze,
        getAlignPoint: We,
        DEFAULT_FONT: Ve,
        DEFAULT_TEXTSIZE: Ue,
        getFont: Je,
        splitTextToRow: qe,
        hashCode: Xe
    })
      , li = f ? function(t) {
        return t[0]
    }
    : function(t) {
        for (var e = document.documentElement && document.documentElement.style || {}, i = 0; i < t.length; i++)
            if (t[i]in e)
                return t[i];
        return !1
    }
      , ui = li(["transform", "WebkitTransform", "OTransform", "MozTransform", "msTransform"])
      , ci = li(["transformOrigin", "WebkitTransformOrigin", "OTransformOrigin", "MozTransformOrigin", "msTransformOrigin"])
      , di = li(["transition", "WebkitTransition", "OTransition", "MozTransition", "msTransition"])
      , fi = li(["filter", "WebkitFilter", "OFilter", "MozFilter", "msFilter"]);
    function gi(t, e) {
        var i = document.createElement(t);
        return e && Ri(i, e),
        i
    }
    function pi(t, e, i) {
        var n = gi(t);
        return e && Ti(n, e),
        i && i.appendChild(n),
        n
    }
    function mi(t) {
        if (!t)
            return this;
        if ($.ielt9 || $.ie9) {
            var e = gi("div");
            e.appendChild(t),
            e.innerHTML = "",
            e = null
        } else
            t.parentNode && t.parentNode.removeChild(t);
        return this
    }
    function _i(e, t, i, n) {
        if (!(e && e.addEventListener && t && i))
            return this;
        for (var r = function(t) {
            t || (t = window.event),
            i.call(n || e, t)
        }, o = t.split(" "), s = o.length - 1; 0 <= s; s--) {
            var a = o[s];
            if (a)
                e["Z__" + a] || (e["Z__" + a] = []),
                0 <= yi(e, a, i) && (console.warn(e, "find '" + a + "' handler:", i, " The old listener function will be removed"),
                vi(e, a, i)),
                e["Z__" + a].push({
                    callback: r,
                    src: i
                }),
                e.addEventListener(a, r, !!$.supportsPassive && {
                    capture: !1,
                    passive: !1
                })
        }
        return this
    }
    function vi(i, t, e) {
        function n(t, e) {
            "mousewheel" === t && $.gecko && (t = "DOMMouseScroll"),
            i.removeEventListener(t, e, !1)
        }
        if (!i || !i.removeEventListener || !t)
            return this;
        for (var r = t.split(" "), o = r.length - 1; 0 <= o; o--) {
            var s = r[o];
            if (s) {
                if (!e && i["Z__" + s]) {
                    for (var a = i["Z__" + s], h = 0, l = a.length; h < l; h++)
                        n(a[h].callback);
                    return delete i["Z__" + s],
                    this
                }
                var u = yi(i, s, e);
                if (u < 0)
                    return this;
                n(s, i["Z__" + s][u].callback),
                i["Z__" + s].splice(u, 1)
            }
        }
        return this
    }
    function yi(t, e, i) {
        if (!t || !t["Z__" + e] || !i)
            return -1;
        for (var n = t["Z__" + e], r = 0, o = n.length; r < o; r++)
            if (n[r].src === i)
                return r;
        return -1
    }
    function xi(t) {
        return t.preventDefault ? t.preventDefault() : t.returnValue = !1,
        this
    }
    function wi(t) {
        return t._cancelBubble = !0,
        t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0,
        this
    }
    function Ci(t) {
        return t.onselectstart = function() {
            return !1
        }
        ,
        t.ondragstart = function() {
            return !1
        }
        ,
        t.setAttribute("unselectable", "on"),
        this
    }
    function bi(t, e) {
        return t ? ($.any3d ? ki(t, e) : (t.style.left = e.x + "px",
        t.style.top = e.y + "px"),
        e) : null
    }
    function Pi(t) {
        var e = window.getComputedStyle(t)
          , i = [parseInt(e["padding-left"]), parseInt(e["padding-top"])]
          , n = t.getBoundingClientRect()
          , r = t.offsetWidth
          , o = t.offsetHeight
          , s = r ? n.width / r : 1
          , a = o ? n.height / o : 1;
        return t.__position = [n.left + i[0], n.top + i[1], s, a],
        t.__position
    }
    function Mi(t, e) {
        t || (t = window.event);
        var i = e.__position;
        return i || (i = Pi(e)),
        new dt((t.clientX - i[0] - e.clientLeft) / i[2],(t.clientY - i[1] - e.clientTop) / i[3])
    }
    function Ti(t, e) {
        var i, n, r, o = t.style.cssText;
        return n = ";",
        0 <= (r = (i = o).length - n.length) && i.indexOf(n, r) === r || (o += ";"),
        t.style.cssText = o + e,
        this
    }
    function Si(t, e) {
        if (void 0 !== t.classList)
            return t.classList.contains(e);
        var i = Ai(t);
        return 0 < i.length && new RegExp("(^|\\s)" + e + "(\\s|$)").test(i)
    }
    function Ei(t, e) {
        if (void 0 === t.classList || Si(t, e)) {
            var i = Ai(t);
            Ri(t, (i ? i + " " : "") + e)
        } else
            for (var n = ze(e), r = 0, o = n.length; r < o; r++)
                t.classList.add(n[r]);
        return this
    }
    function Ri(t, e) {
        return ut(t.className.baseVal) ? t.className = e : t.className.baseVal = e,
        this
    }
    function Ai(t) {
        return ut(t.className.baseVal) ? t.className : t.className.baseVal
    }
    function ki(t, e) {
        var i = e || new dt(0,0);
        return t.style[ui] = $.any3d ? "translate3d(" + i.x + "px," + i.y + "px,0px)" : "translate(" + i.x + "px," + i.y + "px)",
        this
    }
    function Oi(t) {
        return /<[a-z\][\s\S]*>/i.test(t)
    }
    function Li(t, e) {
        var i = Di(t);
        P(e) ? i.innerHTML = e : i.appendChild(e);
        var n = new Oe(i.clientWidth,i.clientHeight);
        return mi(i),
        n
    }
    function Di(t) {
        var e = document.createElement(t);
        return e.style.cssText = "position:absolute;left:-10000px;top:-10000px;",
        document.body.appendChild(e),
        e
    }
    var Ii = _i
      , zi = vi;
    function ji(t) {
        return t && ("mousemove" === t || "touchmove" === t)
    }
    function Fi(t, e) {
        var i = x()
          , n = e || 48;
        return !!(t._mousemoveTime && i - t._mousemoveTime < n) || (t._mousemoveTime = i,
        !1)
    }
    var Gi = Object.freeze({
        TRANSFORM: ui,
        TRANSFORMORIGIN: ci,
        TRANSITION: di,
        CSSFILTER: fi,
        createEl: gi,
        createElOn: pi,
        removeDomNode: mi,
        addDomEvent: _i,
        removeDomEvent: vi,
        listensDomEvent: yi,
        preventDefault: xi,
        stopPropagation: wi,
        preventSelection: Ci,
        offsetDom: bi,
        computeDomPosition: Pi,
        getEventContainerPoint: Mi,
        setStyle: Ti,
        hasClass: Si,
        addClass: Ei,
        setClass: Ri,
        getClass: Ai,
        setOpacity: function(t, e) {
            return t.style.opacity = e,
            this
        },
        setTransform: ki,
        setTransformMatrix: function(t, e) {
            var i = "matrix(" + (P(e) ? e : e.join()) + ")";
            return t.style[ui] !== i && (t.style[ui] = i),
            this
        },
        removeTransform: function(t) {
            return t.style[ui] && (t.style[ui] = ""),
            this
        },
        isHTML: Oi,
        measureDom: Li,
        getDomRuler: Di,
        on: Ii,
        off: zi,
        isMoveEvent: ji,
        MOUSEMOVE_THROTTLE_TIME: 48,
        isMousemoveEventBlocked: Fi
    })
      , Hi = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
    function Bi(t, e) {
        return t(e = {
            exports: {}
        }, e.exports),
        e.exports
    }
    var Ni, Zi = Bi(function(t) {
        !function(o) {
            function s(t) {
                if (t) {
                    var e = this;
                    t(function(t) {
                        e.resolve(t)
                    }, function(t) {
                        e.reject(t)
                    })
                }
            }
            function a(e, t) {
                if ("function" == typeof e.y)
                    try {
                        var i = e.y.call(u, t);
                        e.p.resolve(i)
                    } catch (t) {
                        e.p.reject(t)
                    }
                else
                    e.p.resolve(t)
            }
            function h(e, t) {
                if ("function" == typeof e.n)
                    try {
                        var i = e.n.call(u, t);
                        e.p.resolve(i)
                    } catch (t) {
                        e.p.reject(t)
                    }
                else
                    e.p.reject(t)
            }
            var l, u, c = "fulfilled", d = "undefined", f = function() {
                function e() {
                    for (; i.length - n; ) {
                        try {
                            i[n]()
                        } catch (t) {
                            o.console && o.console.error(t)
                        }
                        i[n++] = u,
                        1024 == n && (i.splice(0, 1024),
                        n = 0)
                    }
                }
                var i = []
                  , n = 0
                  , r = function() {
                    if (typeof MutationObserver !== d) {
                        var t = document.createElement("div");
                        return new MutationObserver(e).observe(t, {
                            attributes: !0
                        }),
                        function() {
                            t.setAttribute("a", 0)
                        }
                    }
                    return typeof setImmediate !== d ? function() {
                        setImmediate(e)
                    }
                    : function() {
                        setTimeout(e, 0)
                    }
                }();
                return function(t) {
                    i.push(t),
                    i.length - n == 1 && r()
                }
            }();
            s.prototype = {
                resolve: function(i) {
                    if (this.state === l) {
                        if (i === this)
                            return this.reject(new TypeError("Attempt to resolve promise with self"));
                        var n = this;
                        if (i && ("function" == typeof i || "object" == typeof i))
                            try {
                                var e = !0
                                  , t = i.then;
                                if ("function" == typeof t)
                                    return void t.call(i, function(t) {
                                        e && (e = !1,
                                        n.resolve(t))
                                    }, function(t) {
                                        e && (e = !1,
                                        n.reject(t))
                                    })
                            } catch (t) {
                                return void (e && this.reject(t))
                            }
                        this.state = c,
                        this.v = i,
                        n.c && f(function() {
                            for (var t = 0, e = n.c.length; t < e; t++)
                                a(n.c[t], i)
                        })
                    }
                },
                reject: function(i) {
                    if (this.state === l) {
                        this.state = "rejected",
                        this.v = i;
                        var n = this.c;
                        n ? f(function() {
                            for (var t = 0, e = n.length; t < e; t++)
                                h(n[t], i)
                        }) : !s.suppressUncaughtRejectionError && o.console && o.console.log("You upset Zousan. Please catch rejections: ", i, i ? i.stack : null)
                    }
                },
                then: function(t, e) {
                    var i = new s
                      , n = {
                        y: t,
                        n: e,
                        p: i
                    };
                    if (this.state === l)
                        this.c ? this.c.push(n) : this.c = [n];
                    else {
                        var r = this.state
                          , o = this.v;
                        f(function() {
                            r === c ? a(n, o) : h(n, o)
                        })
                    }
                    return i
                },
                catch: function(t) {
                    return this.then(null, t)
                },
                finally: function(t) {
                    return this.then(t, t)
                },
                timeout: function(t, n) {
                    n = n || "Timeout";
                    var r = this;
                    return new s(function(e, i) {
                        setTimeout(function() {
                            i(Error(n))
                        }, t),
                        r.then(function(t) {
                            e(t)
                        }, function(t) {
                            i(t)
                        })
                    }
                    )
                }
            },
            s.resolve = function(t) {
                var e = new s;
                return e.resolve(t),
                e
            }
            ,
            s.reject = function(t) {
                var e = new s;
                return e.reject(t),
                e
            }
            ,
            s.all = function(i) {
                function t(t, e) {
                    t && "function" == typeof t.then || (t = s.resolve(t)),
                    t.then(function(t) {
                        n[e] = t,
                        ++r == i.length && o.resolve(n)
                    }, function(t) {
                        o.reject(t)
                    })
                }
                for (var n = [], r = 0, o = new s, e = 0; e < i.length; e++)
                    t(i[e], e);
                return i.length || o.resolve(n),
                o
            }
            ,
            t.exports && (t.exports = s),
            o.define && o.define.amd && o.define([], function() {
                return s
            }),
            (o.Zousan = s).soon = f
        }(Hi)
    }), Wi = "undefined" != typeof Promise ? Promise : Zi, Vi = "core-fetch-image";
    var Ui = !1;
    var Ji = [];
    function qi(t) {
        return -1 < Ji.indexOf(t)
    }
    function Xi(t) {
        qi(t) || Ji.push(t)
    }
    var Yi = {};
    function Qi(t, e) {
        Yi[t] = e
    }
    var Ki, $i = "\n    var adapters = {};\n    // Dynamic Create Adapter\n    function createAdapter(key,code){\n        if(adapters[key]||!code){\n            return;\n        }\n        var func=new Function('exports',code+'(exports)');\n        var workerExports={};\n        func(workerExports,self);\n        adapters[key]=workerExports;\n        workerExports.initialize && workerExports.initialize(self);\n        \n    }\n    onmessage = function (msg) {\n        msg = msg.data;\n        //createAdapter\n        if (msg.messageType === 'createAdapter') {\n           var key=msg.key;\n           var code=msg.code;\n           createAdapter(key,code);\n           postMessage({adapterName:key});\n           return;\n        }\n        // postMessage when main thread idle\n        if(msg.messageType==='idle'){\n            var messageCount = msg.messageCount||5;\n            handleMessageQueue(messageCount);\n            return;\n        }\n        if (msg.messageType === 'batch') {\n            const messages = msg.messages;\n            if (messages) {\n                for (let i = 0; i < messages.length; i++) {\n                    dispatch(messages[i]);\n                }\n            }\n        } else {\n            dispatch(msg);\n        }\n    };\n\n    function dispatch(msg) {\n        var workerKey = msg.workerKey;\n        var adapter = adapters[workerKey];\n        if (!adapter) {\n            post(msg.callback, 'Unregistered worker adapters for ' + workerKey);\n            return;\n        }\n        try {\n            adapter.onmessage(msg, wrap(msg.callback));\n        } catch (err) {\n            post(msg.callback, workerKey + ':' + err.message);\n            console.error(err);\n            throw err;\n        }\n    }\n\n    var messageResultQueue = [];\n    \n    function handleMessageQueue(messageCount){\n       if(messageResultQueue.length===0){\n          return;\n       }\n       var queues = messageResultQueue.slice(0,messageCount);\n       queues.forEach(function(queue){\n          post(queue.callback,queue.err,queue.data,queue.buffers);\n       });\n       messageResultQueue=messageResultQueue.slice(messageCount,Infinity);\n    }\n\n    function post(callback, err, data, buffers) {\n        var msg = {\n            callback : callback\n        };\n        if (err) {\n            msg.error = err;\n        } else {\n            msg.data = data;\n        }\n        if (buffers && buffers.length > 0) {\n            postMessage(msg, buffers);\n        } else {\n            postMessage(msg);\n        }\n    }\n\n    function joinQueue(callback,err,data,buffers){\n        messageResultQueue.push({\n            callback:callback,\n            err:err,\n            data:data,\n            buffers:buffers\n        });\n    }\n\n    function wrap(callback) {\n        return function (err, data, buffers) {\n            joinQueue(callback, err, data, buffers);\n        };\n    }\n    var workerExports;\n", tn = "\n    workerExports = null;\n";
    function en() {
        if ("undefined" == typeof window)
            return null;
        if (!Ki) {
            var t = function() {
                var t = $i;
                for (var e in Yi) {
                    var i = Yi[e];
                    Xi(e),
                    H(i) && 0 === i.length && (i = i()),
                    t += "\n    workerExports = {};\n    (" + i + ")(workerExports, self);\n    adapters['" + e + "'] = workerExports",
                    t += "\n    workerExports.initialize && workerExports.initialize(self);\n        "
                }
                return t += tn
            }();
            Ki = window.URL.createObjectURL(new Blob([t],{
                type: "text/javascript"
            })),
            Yi = {}
        }
        return Ki
    }
    function nn(i, n) {
        if (Yi[i]) {
            var e = Yi[i];
            H(e) && 0 === e.length && (e = e()),
            e = "(" + e + ")";
            if (Ni) {
                var r = Ni.workers || [];
                0 === r.length && console.error("workerpool workers count is 0");
                var o = 0
                  , s = function e(t) {
                    (t = t.data || {}).adapterName === i && ++o === r.length && (r.forEach(function(t) {
                        t.removeEventListener("message", e)
                    }),
                    delete Yi[i],
                    n())
                };
                r.forEach(function(t) {
                    t.addEventListener("message", s),
                    t.postMessage({
                        key: i,
                        code: e,
                        messageType: "createAdapter"
                    })
                })
            }
        } else
            console.error("not find " + i + " adapter")
    }
    var rn, on = "undefined" != typeof window ? window.navigator.hardwareConcurrency || 4 : 0, sn = Math.max(Math.floor(on / 2), 1), an = function() {
        function t(t) {
            void 0 === t && (t = 50),
            this._limit = t,
            this._messages = [],
            this.buffers = []
        }
        var e = t.prototype;
        return e.addMessage = function(t, e) {
            if (this._messages.push(t),
            Array.isArray(e))
                for (var i = 0; i < e.length; i++)
                    this.buffers.indexOf(e[i]) < 0 && this.buffers.push(e[i])
        }
        ,
        e.isFull = function() {
            return this._messages.length >= this._limit
        }
        ,
        e.getMessage = function() {
            return {
                messageType: "batch",
                messages: this._messages
            }
        }
        ,
        t
    }(), hn = function() {
        function t() {
            this.active = {},
            this.workerCount = "undefined" != typeof window ? y.workerCount || sn : 0,
            this._messages = [],
            this._messageBuffers = []
        }
        var e = t.prototype;
        return e.acquire = function(t) {
            if (!this.workers) {
                this.workers = [];
                for (var e = en(), i = 0; i < this.workerCount; i++) {
                    var n = new Worker(e);
                    n.id = i,
                    this.workers.push(n)
                }
                URL.revokeObjectURL(e),
                Ui = !0
            }
            return this.active[t] = !0,
            this.workers.slice()
        }
        ,
        e.release = function(t) {
            delete this.active[t],
            0 === Object.keys(this.active).length && (this.workers.forEach(function(t) {
                t.terminate()
            }),
            this.workers = null)
        }
        ,
        e.addMessage = function(t, e, i) {
            var n = this._messages[t];
            n && n.length || (n = this._messages[t] = [new an]);
            var r = n[n.length - 1];
            r.isFull() && (r = new an,
            this._messages[t].push(r)),
            r.addMessage(e, i)
        }
        ,
        e.commit = function() {
            if (this.workers && this._messages.length)
                for (var t = 0; t < this._messages.length; t++)
                    if (this._messages[t] && this._messages[t].length) {
                        var e = this._messages[t].shift();
                        this.workers[t].postMessage(e.getMessage(), e.buffers)
                    }
        }
        ,
        e.getWorkers = function() {
            return this.workers || []
        }
        ,
        e.broadcastIdleMessage = function() {
            return this.getWorkers().forEach(function(t) {
                t.postMessage({
                    messageType: "idle",
                    messageCount: y.taskCountPerWorkerMessage
                })
            }),
            this
        }
        ,
        t
    }();
    function ln() {
        return rn || (rn = new hn,
        Ni = rn),
        rn
    }
    var un = [];
    function cn(i) {
        return _n(),
        new Wi(function(t, e) {
            i ? (H(i) && (i = {
                count: 1,
                run: i
            }),
            i.run ? (ut(i.count) && (i.count = 1),
            i.count = Math.ceil(i.count),
            G(i.count) ? (i.results = [],
            un.push(i),
            i.resolve = t) : e(new Error("task.count is not number"))) : e(new Error("task.run is null"))) : e(new Error("task is null"))
        }
        )
    }
    var dn = !0;
    function fn() {
        dn ? ln().broadcastIdleMessage() : ln().commit(),
        function() {
            if (0 !== un.length) {
                for (var t = [], e = [], i = un.length, n = 0; n < i; n++) {
                    var r = un[n];
                    if (r.count--,
                    -1 === r.count)
                        e.push(r);
                    else {
                        t.push(r);
                        var o = r.run();
                        r.results.push(o)
                    }
                }
                un = t,
                i = e.length;
                for (var s = 0; s < i; s++) {
                    var a = e[s];
                    a.resolve && a.resolve(a.results)
                }
            }
        }(),
        dn = !dn
    }
    var gn = x();
    function pn(t) {
        var e = y.idleTimeRemaining
          , i = y.idleLog
          , n = y.idleTimeout
          , r = y.idleForceTimeThreshold;
        if ($.requestIdleCallback) {
            if (t && t.timeRemaining) {
                var o = t.timeRemaining();
                if (e < o || t.didTimeout)
                    t.didTimeout && i && console.error("idle timeout in", n),
                    fn(),
                    gn = x();
                else
                    r < x() - gn && (fn(),
                    gn = x()),
                    o <= e && i && console.warn("currrent page is busy,the timeRemaining is", o)
            }
            requestIdleCallback(pn, {
                timeout: n
            })
        } else
            fn(),
            ht(pn),
            i && console.warn("current env not support requestIdleCallback. Fallback to requestAnimFrame")
    }
    var mn = !1;
    function _n() {
        if (!mn) {
            mn = !0;
            var t = y.idleTimeout;
            $.requestIdleCallback ? requestIdleCallback(pn, {
                timeout: t
            }) : ht(pn)
        }
    }
    var vn, yn = Object.freeze({
        runTaskAsync: cn,
        startTasks: _n
    }), xn = "function" == typeof Map, wn = function() {}, Cn = function() {
        function t(t, e) {
            this.max = t,
            this.onRemove = e || wn,
            this.reset()
        }
        var e = t.prototype;
        return e.reset = function() {
            for (var t in this.data)
                this.onRemove(this.data[t]);
            return this.data = {},
            this.order = [],
            this
        }
        ,
        e.clear = function() {
            this.reset(),
            delete this.onRemove
        }
        ,
        e.add = function(t, e) {
            if (this.has(t))
                this.order.splice(this.order.indexOf(t), 1),
                this.data[t] = e,
                this.order.push(t);
            else if (this.data[t] = e,
            this.order.push(t),
            this.order.length > this.max) {
                var i = this.getAndRemove(this.order[0]);
                i && this.onRemove(i)
            }
            return this
        }
        ,
        e.has = function(t) {
            return t in this.data
        }
        ,
        e.keys = function() {
            return this.order
        }
        ,
        e.getAndRemove = function(t) {
            if (!this.has(t))
                return null;
            var e = this.data[t];
            return delete this.data[t],
            this.order.splice(this.order.indexOf(t), 1),
            e
        }
        ,
        e.get = function(t) {
            return this.has(t) ? this.data[t] : null
        }
        ,
        e.remove = function(t) {
            if (!this.has(t))
                return this;
            var e = this.data[t];
            return delete this.data[t],
            this.onRemove(e),
            this.order.splice(this.order.indexOf(t), 1),
            this
        }
        ,
        e.setMaxSize = function(t) {
            for (this.max = t; this.order.length > this.max; ) {
                var e = this.getAndRemove(this.order[0]);
                e && this.onRemove(e)
            }
            return this
        }
        ,
        t
    }();
    xn && (vn = function() {
        function t(t, e) {
            this.max = t,
            this.onRemove = e || wn,
            this.reset()
        }
        var e = t.prototype;
        return e.reset = function() {
            if (this.data) {
                var t = this.data.values()
                  , e = Array.isArray(t)
                  , i = 0;
                for (t = e ? t : t[Symbol.iterator](); ; ) {
                    var n;
                    if (e) {
                        if (i >= t.length)
                            break;
                        n = t[i++]
                    } else {
                        if ((i = t.next()).done)
                            break;
                        n = i.value
                    }
                    var r = n;
                    this.onRemove(r)
                }
            }
            return this.data = new Map,
            this
        }
        ,
        e.clear = function() {
            this.reset(),
            delete this.onRemove
        }
        ,
        e.add = function(t, e) {
            return e && (this.has(t) && this.data.delete(t),
            this.data.set(t, e)),
            this
        }
        ,
        e.keys = function() {
            var t = new Array(this.data.size)
              , e = 0
              , i = this.data.keys()
              , n = Array.isArray(i)
              , r = 0;
            for (i = n ? i : i[Symbol.iterator](); ; ) {
                var o;
                if (n) {
                    if (r >= i.length)
                        break;
                    o = i[r++]
                } else {
                    if ((r = i.next()).done)
                        break;
                    o = r.value
                }
                var s = o;
                t[e++] = s
            }
            return t
        }
        ,
        e.shrink = function() {
            for (var t = this.data.keys(), e = t.next(); this.data.size > this.max; ) {
                var i = this.getAndRemove(e.value);
                i && this.onRemove(i),
                e = t.next()
            }
        }
        ,
        e.has = function(t) {
            return this.data.has(t)
        }
        ,
        e.getAndRemove = function(t) {
            if (!this.has(t))
                return null;
            var e = this.data.get(t);
            return this.data.delete(t),
            e
        }
        ,
        e.get = function(t) {
            return this.has(t) ? this.data.get(t) : null
        }
        ,
        e.remove = function(t) {
            if (!this.has(t))
                return this;
            var e = this.data.get(t);
            return this.data.delete(t),
            this.onRemove(e),
            this
        }
        ,
        e.setMaxSize = function(t) {
            return this.max = t,
            this.data.size > this.max && this.shrink(),
            this
        }
        ,
        t
    }());
    var bn = xn ? vn : Cn
      , Pn = {
        jsonp: function(t, e) {
            var i = "_maptalks_jsonp_" + mt();
            t.match(/\?/) ? t += "&callback=" + i : t += "?callback=" + i;
            var n = document.createElement("script");
            return n.type = "text/javascript",
            n.src = t,
            window[i] = function(t) {
                e(null, t),
                document.getElementsByTagName("head")[0].removeChild(n),
                n = null,
                delete window[i]
            }
            ,
            document.getElementsByTagName("head")[0].appendChild(n),
            this
        },
        get: function(t, e, i) {
            if (H(e)) {
                var n = i;
                i = e,
                e = n
            }
            if (f && Pn.get.node)
                return Pn.get.node(t, i, e);
            var r = Pn._getClient(i);
            if (r.open("GET", t, !0),
            e) {
                for (var o in e.headers)
                    r.setRequestHeader(o, e.headers[o]);
                r.withCredentials = "include" === e.credentials,
                e.responseType && (r.responseType = e.responseType)
            }
            return r.send(null),
            r
        },
        post: function(t, e, i) {
            var n;
            if (P(t)) {
                if (H(e)) {
                    var r = i;
                    i = e,
                    e = r
                }
                n = (e = e || {}).postData
            } else {
                var o = i;
                n = e,
                t = (e = t).url,
                i = o
            }
            if (f && Pn.post.node)
                return e.url = t,
                Pn.post.node(e, n, i);
            var s = Pn._getClient(i);
            if (s.open("POST", e.url, !0),
            e.headers || (e.headers = {}),
            e.headers["Content-Type"] || (e.headers["Content-Type"] = "application/x-www-form-urlencoded"),
            "setRequestHeader"in s)
                for (var a in e.headers)
                    e.headers.hasOwnProperty(a) && s.setRequestHeader(a, e.headers[a]);
            return P(n) || (n = JSON.stringify(n)),
            s.send(n),
            s
        },
        _wrapCallback: function(t, e) {
            return function() {
                4 === t.readyState && (200 === t.status ? "arraybuffer" === t.responseType ? 0 === t.response.byteLength ? e(new Error("http status 200 returned without content.")) : e(null, {
                    data: t.response,
                    cacheControl: t.getResponseHeader("Cache-Control"),
                    expires: t.getResponseHeader("Expires"),
                    contentType: t.getResponseHeader("Content-Type")
                }) : e(null, t.responseText) : e(new Error(t.statusText + "," + t.status)))
            }
        },
        _getClient: function(t) {
            var e;
            try {
                e = new XMLHttpRequest
            } catch (t) {
                try {
                    e = new ActiveXObject("Msxml2.XMLHTTP")
                } catch (t) {
                    try {
                        e = new ActiveXObject("Microsoft.XMLHTTP")
                    } catch (t) {}
                }
            }
            return e.onreadystatechange = Pn._wrapCallback(e, t),
            e
        },
        getArrayBuffer: function(t, e, i) {
            if (H(e)) {
                var n = i;
                i = e,
                e = n
            }
            return e || (e = {}),
            e.responseType = "arraybuffer",
            Pn.get(t, e, i)
        },
        getImage: function(o, t, e) {
            return Pn.getArrayBuffer(t, e, function(t, e) {
                if (t)
                    o.onerror && o.onerror(t);
                else if (e) {
                    var i = window.URL || window.webkitURL
                      , n = o.onload;
                    o.onload = function() {
                        n && n(),
                        i.revokeObjectURL(o.src)
                    }
                    ;
                    var r = new Blob([new Uint8Array(e.data)],{
                        type: e.contentType
                    });
                    o.cacheControl = e.cacheControl,
                    o.expires = e.expires,
                    o.src = e.data.byteLength ? i.createObjectURL(r) : jt
                }
            })
        },
        getJSON: function(t, e, n) {
            if (H(e)) {
                var i = n;
                n = e,
                e = i
            }
            var r = function(t, e) {
                var i = e ? vt(e) : null;
                n(t, i)
            };
            return e && e.jsonp ? Pn.jsonp(t, r) : Pn.get(t, e, r)
        }
    }
      , Mn = 1 / 0
      , Tn = 1 / 0
      , Sn = -1 / 0
      , En = -1 / 0;
    function Rn() {
        return [Mn, Tn, Sn, En]
    }
    var An = Rn();
    function kn(t) {
        t[0] = Mn,
        t[1] = Tn,
        t[2] = Sn,
        t[3] = En
    }
    function On(t, e) {
        if (t)
            if (Array.isArray(t[0]))
                for (var i = 0, n = t.length; i < n; i++)
                    On(t[i], e);
            else if (Array.isArray(t))
                for (var r = 0, o = t.length; r < o; r++) {
                    var s = t[r]
                      , a = s.x
                      , h = s.y;
                    e[0] = Math.min(a, e[0]),
                    e[1] = Math.min(h, e[1]),
                    e[2] = Math.max(a, e[2]),
                    e[3] = Math.max(h, e[3])
                }
            else {
                a = t.x,
                h = t.y;
                e[0] = Math.min(a, e[0]),
                e[1] = Math.min(h, e[1]),
                e[2] = Math.max(a, e[2]),
                e[3] = Math.max(h, e[3])
            }
    }
    function Ln(t, e, i, n, r) {
        (0 === e || e) && (Array.isArray(e) && (i = e[1],
        n = e[2],
        r = e[3],
        e = e[0]),
        t[0] = Math.min(e, t[0]),
        t[1] = Math.min(i, t[1]),
        t[2] = Math.max(n, t[2]),
        t[3] = Math.max(r, t[3]))
    }
    function Dn(t) {
        return t && t[0] !== 1 / 0 && void 0 !== t[0]
    }
    function In(t, e) {
        void 0 === e && (e = 0),
        t[0] -= e,
        t[1] -= e,
        t[2] += e,
        t[3] += e
    }
    var zn = !1
      , jn = null
      , Fn = Math.PI / 180
      , Gn = {
        getCanvas2DContext: function(t) {
            return t.getContext("2d", {
                willReadFrequently: !0
            })
        },
        setHitTesting: function(t) {
            zn = t
        },
        createCanvas: function(t, e, i) {
            var n;
            return f ? n = new i(t,e) : ((n = gi("canvas")).width = t,
            n.height = e),
            n
        },
        prepareCanvasFont: function(t, e) {
            "top" !== t.textBaseline && (t.textBaseline = "top");
            var i = Je(e);
            t.font !== i && (t.font = i);
            var n = e.textFill;
            n || (n = "#000");
            var r = Gn.getRgba(n, e.textOpacity);
            t.fillStyle !== r && (t.fillStyle = r)
        },
        prepareCanvas: function(t, e, i, n) {
            if (e) {
                var r = e.lineWidth;
                ut(r) || t.lineWidth === r || (t.lineWidth = r);
                var o = e.linePatternFile
                  , s = e.lineColor || "#000";
                if (n)
                    t.strokeStyle = "#000";
                else if (o && i) {
                    var a;
                    (e.linePatternDx || e.linePatternDy) && (a = [e.linePatternDx, e.linePatternDy]),
                    Gn._setStrokePattern(t, o, r, a, i),
                    e.lineDasharray = []
                } else
                    Qe(s) ? e.lineGradientExtent ? t.strokeStyle = Gn._createGradient(t, s, e.lineGradientExtent) : t.strokeStyle = "#000" : (Array.isArray(s) && (s = Gn.normalizeColorToRGBA(s)),
                    t.strokeStyle = s);
                e.lineJoin && (t.lineJoin = e.lineJoin),
                e.lineCap && (t.lineCap = e.lineCap),
                t.setLineDash && St(e.lineDasharray) && t.setLineDash(e.lineDasharray);
                var h = e.polygonPatternFile
                  , l = e.polygonFill || "rgba(255,255,255,0)";
                if (n)
                    t.fillStyle = "#000";
                else if (h && i) {
                    var u = Nn(h)
                      , c = i.getImage([u, null, null]);
                    if (c || (c = i.getImage([u + "-texture", null, r])),
                    ft(u) && c instanceof Image && ($.edge || $.ie)) {
                        var d = c.width || 20
                          , f = c.height || 20
                          , g = Gn.createCanvas(d, f);
                        Gn.image(g.getContext("2d"), c, 0, 0, d, f),
                        c = g
                    }
                    c ? (t.fillStyle = t.createPattern(c, "repeat"),
                    (e.polygonPatternDx || e.polygonPatternDy) && (t.fillStyle.polygonPatternOffset = [e.polygonPatternDx, e.polygonPatternDy])) : "undefined" != typeof console && console.warn("img not found for", u)
                } else
                    Qe(l) ? e.polygonGradientExtent ? t.fillStyle = Gn._createGradient(t, l, e.polygonGradientExtent) : t.fillStyle = "rgba(255,255,255,0)" : (Array.isArray(l) && (l = Gn.normalizeColorToRGBA(l)),
                    t.fillStyle = l)
            }
        },
        _createGradient: function(t, e, i) {
            var n = null
              , r = e.places
              , o = i.getMin()
              , s = i.getMax()
              , a = i.getWidth()
              , h = i.getHeight();
            if (e.type && "linear" !== e.type) {
                if ("radial" === e.type) {
                    if (r) {
                        if (6 !== r.length)
                            throw new Error("A radial gradient's places should have 6 numbers.");
                        r = [o.x + r[0] * a, o.y + r[1] * h, a * r[2], o.x + r[3] * a, o.y + r[4] * h, a * r[5]]
                    } else {
                        var l = i.getCenter()._round();
                        r = [l.x, l.y, Math.abs(l.x - o.x), l.x, l.y, 0]
                    }
                    n = t.createRadialGradient.apply(t, r)
                }
            } else {
                if (r) {
                    if (4 !== r.length)
                        throw new Error("A linear gradient's places should have 4 numbers.");
                    r = [o.x + r[0] * a, o.y + r[1] * h, o.x + r[2] * a, o.y + r[3] * h]
                } else
                    r = [o.x, o.y, s.x, o.y];
                n = t.createLinearGradient.apply(t, r)
            }
            return e.colorStops.forEach(function(t) {
                n.addColorStop.apply(n, t)
            }),
            n
        },
        _setStrokePattern: function(t, e, i, n, r) {
            var o, s = Nn(e);
            if (f)
                o = r.getImage([s, null, i]);
            else {
                var a = s + "-texture-" + i;
                if (!(o = r.getImage(a))) {
                    var h = r.getImage([s, null, null]);
                    if (h) {
                        var l;
                        l = h.width && h.height ? Math.round(h.width * i / h.height) : i;
                        var u = Gn.createCanvas(l, i, t.canvas.constructor);
                        Gn.image(u.getContext("2d"), h, 0, 0, l, i),
                        r.addResource([a, null, i], u),
                        o = u
                    }
                }
            }
            o ? (t.strokeStyle = t.createPattern(o, "repeat"),
            t.strokeStyle.linePatternOffset = n) : "undefined" != typeof console && console.warn("img not found for", s)
        },
        clearRect: function(t, e, i, n, r) {
            t.canvas._drawn = !1,
            t.clearRect(e, i, n, r)
        },
        fillCanvas: function(t, e, i, n) {
            if (zn && (e = 1),
            t.canvas._drawn = !0,
            0 !== e) {
                var r, o = Gn._isPattern(t.fillStyle), s = t.fillStyle && t.fillStyle.polygonPatternOffset, a = s ? s[0] : 0, h = s ? s[1] : 0;
                ut(e) && (e = 1),
                e < 1 && (r = t.globalAlpha,
                t.globalAlpha *= e),
                o && (i = i || 0,
                n = n || 0,
                t.translate(i + a, n + h)),
                t.fill(),
                o && t.translate(-i - a, -n - h),
                e < 1 && (t.globalAlpha = r)
            }
        },
        getRgba: function(t, e) {
            return ut(e) && (e = 1),
            "#" !== t[0] ? (Array.isArray(t) && (t = Gn.normalizeColorToRGBA(t, e)),
            t) : (7 === t.length ? (i = parseInt(t.substring(1, 3), 16),
            n = parseInt(t.substring(3, 5), 16),
            r = parseInt(t.substring(5, 7), 16)) : (i = 17 * parseInt(t.substring(1, 2), 16),
            n = 17 * parseInt(t.substring(2, 3), 16),
            r = 17 * parseInt(t.substring(3, 4), 16)),
            "rgba(" + i + "," + n + "," + r + "," + e + ")");
            var i, n, r
        },
        normalizeColorToRGBA: function(t, e) {
            return void 0 === e && (e = 1),
            "rgba(" + 255 * t[0] + "," + 255 * t[1] + "," + 255 * t[2] + "," + (4 === t.length ? t[3] : 1) * e + ")"
        },
        image: function(t, e, i, n, r, o) {
            t.canvas._drawn = !0;
            try {
                G(r) && G(o) ? t.drawImage(e, i, n, r, o) : t.drawImage(e, i, n)
            } catch (t) {
                console && (console.warn("error when drawing image on canvas:", t),
                console.warn(e))
            }
        },
        text: function(t, e, i, n, r) {
            return Gn._textOnMultiRow(t, r.rows, n, i, r.size, r.rawSize)
        },
        _textOnMultiRow: function(t, e, i, n, r, o) {
            var s, a, h = We(r, i.textHorizontalAlignment, i.textVerticalAlignment), l = o.height + i.textLineSpacing, u = n.add(0, h.y), c = i.textMaxHeight, d = 0;
            kn(An);
            for (var f = 0, g = e.length; f < g; f++) {
                s = e[f].text,
                a = We(e[f].size, i.textHorizontalAlignment, i.textVerticalAlignment);
                var p = u.add(a.x, f * l);
                Gn._textOnLine(t, s, p, i.textHaloRadius, i.textHaloFill, i.textHaloOpacity);
                var m = e[f].size
                  , _ = p.x
                  , v = p.y
                  , y = _ + m.width
                  , x = v + m.height;
                if (Ln(An, _, v, y, x),
                0 < c && (d += l) + m.height >= c)
                    break
            }
            return An
        },
        _textOnLine: function(t, e, i, n, r, o) {
            zn && (o = 1);
            var s, a, h = 0 !== o && 0 !== n;
            t.textBaseline = "top";
            var l = t.shadowBlur
              , u = t.shadowOffsetX
              , c = t.shadowOffsetY;
            if (h) {
                var d = t.globalAlpha;
                t.globalAlpha *= o,
                t.miterLimit = 2,
                t.lineJoin = "round",
                t.lineCap = "round",
                t.lineWidth = 2 * n,
                Array.isArray(r) && (r = Gn.normalizeColorToRGBA(r)),
                t.strokeStyle = r,
                t.strokeText(e, i.x, i.y + 1),
                t.miterLimit = 10,
                t.globalAlpha = d,
                s = t.globalCompositeOperation,
                t.globalCompositeOperation = "destination-out",
                a = t.fillStyle,
                t.fillStyle = "#000"
            }
            l && h && (t.shadowBlur = t.shadowOffsetX = t.shadowOffsetY = 0),
            Gn.fillText(t, e, i),
            s && (t.globalCompositeOperation = s,
            Gn.fillText(t, e, i, a),
            l && (t.shadowBlur = l,
            t.shadowOffsetX = u,
            t.shadowOffsetY = c))
        },
        fillText: function(t, e, i, n) {
            t.canvas._drawn = !0,
            n && (t.fillStyle = n),
            t.fillText(e, i.x, i.y + 1)
        },
        _stroke: function(t, e, i, n) {
            if (zn && (e = 1),
            t.canvas._drawn = !0,
            0 !== e) {
                var r, o = t.strokeStyle && t.strokeStyle.linePatternOffset, s = o ? o[0] : 0, a = o ? o[1] : 0, h = Gn._isPattern(t.strokeStyle) && (!ut(i) && !ut(n) || !ut(s) && !ut(a));
                ut(e) && (e = 1),
                e < 1 && (r = t.globalAlpha,
                t.globalAlpha *= e),
                h && (i = i || 0,
                n = n || 0,
                t.translate(i + s, n + a)),
                t.stroke(),
                h && t.translate(-i - s, -n - a),
                e < 1 && (t.globalAlpha = r)
            }
        },
        _path: function(r, t, e, o, i) {
            if (St(t))
                for (var n, s, a = St(e), h = !0 !== i && Gn._isPattern(r.strokeStyle), l = 0, u = t.length; l < u; l++)
                    if (n = t[l],
                    !a || r.setLineDash)
                        r.lineTo(n.x, n.y),
                        h && 0 < l && (c(t[l - 1], n),
                        r.beginPath(),
                        r.moveTo(n.x, n.y));
                    else if (a) {
                        if (l === u - 1)
                            break;
                        s = t[l + 1],
                        Hn(r, n, s, e)
                    }
            function c(t, e) {
                var i = zt(t.x, t.y, e.x, e.y);
                r.save();
                var n = Math.cos(i);
                Math.abs(n) < 1e-7 ? r.translate(t.x - r.lineWidth / 2, t.y) : r.translate(t.x, t.y - r.lineWidth / 2 / n),
                r.rotate(i),
                Gn._stroke(r, o),
                r.restore()
            }
        },
        path: function(t, e, i, n, r) {
            St(e) && (t.beginPath(),
            t.moveTo(e[0].x, e[0].y),
            Gn._path(t, e, r, i),
            Gn._stroke(t, i))
        },
        _multiClip: function(t, e) {
            if (e && 0 !== e.length)
                for (var i = 0, n = (e = e[0]).length; i < n; i++) {
                    var r = e[i]
                      , o = r.x
                      , s = r.y;
                    0 === i ? t.moveTo(o, s) : t.lineTo(o, s),
                    i === n - 1 && (o = e[0].x,
                    s = e[0].y,
                    t.lineTo(o, s))
                }
        },
        polygon: function(t, e, i, n, r, o) {
            if (t.isMultiClip)
                Gn._multiClip(t, e);
            else if (t.isClip)
                Gn._multiClip(t, Array.isArray(e[0]) ? e : [e]);
            else if (St(e)) {
                var s = Gn._isPattern(t.strokeStyle)
                  , a = St(r) && !t.setLineDash || s && !o;
                St(e[0]) || (e = [e]);
                var h, l, u, c = t;
                if (1 < e.length && !f && (jn || (jn = Gn.createCanvas(1, 1)),
                t.canvas._drawn = !1,
                jn.width = t.canvas.width,
                jn.height = t.canvas.height,
                Wn(t = jn.getContext("2d"), []),
                Wn(t, r),
                Zn(t, c)),
                a) {
                    for (t.save(),
                    l = 0,
                    u = e.length; l < u; l++)
                        St(e[l]) && (Gn._ring(t, e[l], null, 0, !0),
                        h = n,
                        0 < l && (t.globalCompositeOperation = "destination-out",
                        h = 1),
                        Gn.fillCanvas(t, h, e[l][0].x, e[l][0].y),
                        0 < l ? t.globalCompositeOperation = "source-over" : 1 < u && (t.fillStyle = "#fff"),
                        Gn._stroke(t, 0));
                    t.restore()
                }
                var d = t.fillStyle;
                for (l = 0,
                u = e.length; l < u; l++)
                    St(e[l]) && (o ? (Gn.paintSmoothLine(t, e[l], i, o, !0),
                    t.closePath()) : Gn._ring(t, e[l], r, i),
                    a || (h = n,
                    0 < l && (t.globalCompositeOperation = "destination-out",
                    h = 1),
                    Gn.fillCanvas(t, h, e[l][0].x, e[l][0].y),
                    0 < l ? t.globalCompositeOperation = "source-over" : 1 < u && (t.fillStyle = "#fff")),
                    Gn._stroke(t, i));
                t.fillStyle !== d && (t.fillStyle = d),
                1 < e.length && !f && (c.drawImage(jn, 0, 0),
                c.canvas._drawn = t.canvas._drawn,
                Zn(c, t))
            }
        },
        _ring: function(t, e, i, n, r) {
            var o = Gn._isPattern(t.strokeStyle);
            r || !o || e[0].equals(e[e.length - 1]) || (e = e.concat([e[0]])),
            t.beginPath(),
            t.moveTo(e[0].x, e[0].y),
            Gn._path(t, e, i, n, r),
            o || t.closePath()
        },
        paintSmoothLine: function(t, e, i, n, r, o, s) {
            if (e)
                if (e.length <= 2 || !n)
                    Gn.path(t, e, i);
                else {
                    var a, h, l, u, c, d, f, g, p, m, _, v, y, x, w, C, b, P, M, T, S, E, R, A, k, O, L, D, I, z, j, F, G, H, B, N, Z, W, V, U, J, q, X, Y, Q, K = e.length, $ = r ? K : K - 1;
                    t.beginPath(),
                    t.moveTo(e[0].x, e[0].y),
                    void 0 !== s && ($ -= Math.max($ - o - 1, 0));
                    for (var tt = 0; tt < $; tt++) {
                        var et = e[tt].x
                          , it = e[tt].y
                          , nt = void 0
                          , rt = void 0
                          , ot = void 0
                          , st = void 0
                          , at = void 0
                          , ht = void 0;
                        tt - 1 < 0 ? r ? (nt = e[$ - 1].x,
                        rt = e[$ - 1].y) : (nt = e[tt + 1].x,
                        rt = e[tt + 1].y) : (nt = e[tt - 1].x,
                        rt = e[tt - 1].y),
                        tt + 1 < K ? (ot = e[tt + 1].x,
                        st = e[tt + 1].y) : (ot = e[tt + 1 - K].x,
                        st = e[tt + 1 - K].y),
                        tt + 2 < K ? (at = e[tt + 2].x,
                        ht = e[tt + 2].y) : r ? (at = e[tt + 2 - K].x,
                        ht = e[tt + 2 - K].y) : (at = e[tt].x,
                        ht = e[tt].y);
                        var lt = (m = n,
                        _ = tt === $ - 1 ? s : 1,
                        L = O = k = A = R = E = S = T = M = P = b = C = w = x = y = v = void 0,
                        D = ((h = nt) + (u = et)) / 2,
                        I = ((l = rt) + (c = it)) / 2,
                        z = (u + (d = ot)) / 2,
                        j = (c + (f = st)) / 2,
                        F = (d + (g = at)) / 2,
                        G = (f + (p = ht)) / 2,
                        H = Math.sqrt((u - h) * (u - h) + (c - l) * (c - l)),
                        B = Math.sqrt((d - u) * (d - u) + (f - c) * (f - c)),
                        N = H / (H + B),
                        Z = B / (B + Math.sqrt((g - d) * (g - d) + (p - f) * (p - f))),
                        q = (W = D + (z - D) * N) + (z - W) * m + u - W,
                        X = (V = I + (j - I) * N) + (j - V) * m + c - V,
                        Y = (U = z + (F - z) * Z) + (z - U) * m + d - U,
                        Q = (J = j + (G - j) * Z) + (j - J) * m + f - J,
                        _ < 1 ? [((x = u) * (E = 1 - (v = 0)) * E + 2 * (C = q) * v * E + (P = Y) * v * v) * (R = 1 - (y = _)) + (C * E * E + 2 * P * v * E + (T = d) * v * v) * y, ((w = c) * E * E + 2 * (b = X) * v * E + (M = Q) * v * v) * R + (b * E * E + 2 * M * v * E + (S = f) * v * v) * y, (A = x * R * R + 2 * C * y * R + P * y * y) * E + (k = C * R * R + 2 * P * y * R + T * y * y) * v, (O = w * R * R + 2 * b * y * R + M * y * y) * E + (L = b * R * R + 2 * M * y * R + S * y * y) * v, A * R + k * y, O * R + L * y] : [q, X, Y, Q]);
                        if (tt === $ - 1 && 0 <= s && s < 1) {
                            t.bezierCurveTo(lt[0], lt[1], lt[2], lt[3], lt[4], lt[5]),
                            e.splice($ - 1, K - ($ - 1) - 1);
                            var ut = new dt(lt[4],lt[5]);
                            ut.prevCtrlPoint = new dt(lt[2],lt[3]),
                            e.push(ut),
                            K = e.length
                        } else
                            t.bezierCurveTo(lt[0], lt[1], lt[2], lt[3], ot, st);
                        e[tt].nextCtrlPoint = lt.slice(0, 2),
                        e[tt].prevCtrlPoint = a ? a.slice(2) : null,
                        a = lt
                    }
                    !r && e[1].prevCtrlPoint && (e[0].nextCtrlPoint = e[1].prevCtrlPoint,
                    delete e[0].prevCtrlPoint),
                    e[K - 1].prevCtrlPoint || (e[K - 1].prevCtrlPoint = e[K - 2].nextCtrlPoint),
                    Gn._stroke(t, i)
                }
        },
        _arcBetween: function(t, e, i, n) {
            var r = n
              , o = e.distanceTo(i)
              , s = o / 2 / Math.sin(r / 2)
              , a = Math.asin((i.y - e.y) / o);
            e.x > i.x && (a = Math.PI - a);
            var h = a - (90 * Fn - r / 2)
              , l = Math.cos(h) * s
              , u = Math.sin(h) * s
              , c = e.x + l
              , d = e.y + u
              , f = Math.asin((i.y - d) / s);
            c > i.x && (f = Math.PI - f);
            var g = f + r;
            return t.beginPath(),
            t.arc(c, d, s, f, g),
            [c, d]
        },
        _lineTo: function(t, e) {
            t.lineTo(e.x, e.y)
        },
        bezierCurveAndFill: function(t, e, i, n) {
            t.beginPath();
            var r = e[0];
            t.moveTo(r.x, r.y);
            var o = [t];
            o.push.apply(o, e.splice(1)),
            Gn._bezierCurveTo.apply(Gn, o),
            Gn.fillCanvas(t, n),
            Gn._stroke(t, i)
        },
        _bezierCurveTo: function(t, e, i, n) {
            t.bezierCurveTo(e.x, e.y, i.x, i.y, n.x, n.y)
        },
        ellipse: function(t, e, i, n, r, o, s) {
            var a, h, l, u, c, d, f, g, p;
            t.beginPath(),
            i === n && i === r ? t.arc(e.x, e.y, i, 0, 2 * Math.PI) : t.ellipse ? n !== r ? (t.ellipse(e.x, e.y, i, n, 0, 180 * Fn, 360 * Fn, !1),
            t.ellipse(e.x, e.y, i, r, 0, 0, 180 * Fn, !1)) : t.ellipse(e.x, e.y, i, n, 0, 0, 360 * Fn, !1) : (a = e.x,
            h = e.y,
            f = (l = i) * (d = .5522848),
            g = (u = n) * d,
            p = (c = r) * d,
            t.moveTo(a - l, h),
            t.bezierCurveTo(a - l, h - g, a - f, h - u, a, h - u),
            t.bezierCurveTo(a + f, h - u, a + l, h - g, a + l, h),
            t.bezierCurveTo(a + l, h + p, a + f, h + c, a, h + c),
            t.bezierCurveTo(a - f, h + c, a - l, h + p, a - l, h),
            t.closePath()),
            Gn.fillCanvas(t, s, e.x - i, e.y - n),
            Gn._stroke(t, o, e.x - i, e.y - n)
        },
        rectangle: function(t, e, i, n, r) {
            var o = e.x
              , s = e.y;
            t.beginPath(),
            t.rect(o, s, i.width, i.height),
            Gn.fillCanvas(t, r, o, s),
            Gn._stroke(t, n, o, s)
        },
        sector: function(t, e, i, n, h, l) {
            var u = Fn
              , r = n[0]
              , o = n[1];
            function s(t, e, i, n, r, o) {
                var s = u * -o
                  , a = u * -r;
                t.beginPath(),
                t.moveTo(e, i),
                t.arc(e, i, n, s, a),
                t.lineTo(e, i),
                Gn.fillCanvas(t, l, e - n, i - n),
                Gn._stroke(t, h, e - n, i - n)
            }
            s(t, e.x, e.y, i, r, o)
        },
        _isPattern: function(t) {
            return !(P(t) || "addColorStop"in t)
        },
        drawCross: function(t, e, i, n, r) {
            t.canvas._drawn = !0,
            t.strokeStyle = r,
            t.lineWidth = n,
            t.beginPath(),
            t.moveTo(e - 5, i),
            t.lineTo(e + 5, i),
            t.moveTo(e, i - 5),
            t.lineTo(e, i + 5),
            t.stroke()
        },
        copy: function(t, e) {
            var i = e || gi("canvas");
            return i.width = t.width,
            i.height = t.height,
            i.getContext("2d").drawImage(t, 0, 0),
            i
        },
        pixelRect: function(t, e, i, n) {
            var r = t.lineWidth
              , o = t.globalAlpha
              , s = !1;
            if (0 < r && 0 < i)
                s = !0,
                i < 1 && (t.globalAlpha *= i);
            else {
                if (!(0 < n))
                    return;
                n < 1 && (t.globalAlpha *= n)
            }
            t.canvas._drawn = !0,
            s ? t.strokeRect(e[0], e[1], 1, 1) : t.fillRect(e[0], e[1], 1, 1),
            t.globalAlpha !== o && (t.globalAlpha = o)
        }
    };
    function Hn(t, e, i, n) {
        var r = e.x
          , o = e.y
          , s = i.x
          , a = i.y
          , h = n
          , l = function(t, e) {
            return t <= e
        }
          , u = function(t, e) {
            return e <= t
        }
          , c = function(t, e) {
            return Math.min(t, e)
        }
          , d = function(t, e) {
            return Math.max(t, e)
        }
          , f = {
            thereYet: u,
            cap: c
        }
          , g = {
            thereYet: u,
            cap: c
        };
        0 < o - a && (g.thereYet = l,
        g.cap = d),
        0 < r - s && (f.thereYet = l,
        f.cap = d),
        t.moveTo(r, o);
        for (var p, m, _ = r, v = o, y = 0, x = !0; !f.thereYet(_, s) || !g.thereYet(v, a); )
            p = Math.atan2(a - o, s - r),
            m = h[y],
            _ = f.cap(s, _ + Math.cos(p) * m),
            v = g.cap(a, v + Math.sin(p) * m),
            x ? t.lineTo(_, v) : t.moveTo(_, v),
            y = (y + 1) % h.length,
            x = !x
    }
    var Bn = "data:image/";
    function Nn(t) {
        return t.substring(0, Bn.length) === Bn ? t : Ot(t)
    }
    function Zn(t, e) {
        t.filter = e.filter,
        t.fillStyle = e.fillStyle,
        t.globalAlpha = e.globalAlpha,
        t.lineCap = e.lineCap,
        t.lineDashOffset = e.lineDashOffset,
        t.lineJoin = e.lineJoin,
        t.lineWidth = e.lineWidth,
        t.shadowBlur = e.shadowBlur,
        t.shadowColor = e.shadowColor,
        t.shadowOffsetX = e.shadowOffsetX,
        t.shadowOffsetY = e.shadowOffsetY,
        t.strokeStyle = e.strokeStyle
    }
    function Wn(t, e) {
        e && t.setLineDash && Array.isArray(e) && t.setLineDash(e)
    }
    function Vn(t) {
        return "Z__" + t
    }
    var Un = function(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            it(e, t);
            var i = e.prototype;
            return i.on = function(t, e, i) {
                if (!t)
                    return this;
                if (!P(t))
                    return this._switch("on", t, e);
                if (!e)
                    return this;
                this._eventMap || (this._eventMap = {});
                var n, r = t.toLowerCase().split(" ");
                i || (i = this);
                var o, s = G(e._id);
                e._id = mt();
                for (var a = 0, h = r.length; a < h; a++) {
                    var l = Vn(n = r[a]);
                    if (e[l] && (e[l]._id = e._id),
                    (o = this._eventMap[n]) || (o = [],
                    this._eventMap[n] = o),
                    s) {
                        var u = o.length;
                        if (0 < u)
                            for (var c = 0; c < u; c++)
                                if (e === o[c].handler && o[c].context === i)
                                    return y.isTest || console.warn(this, "find '" + t + "' handler:", e, " The old listener function will be removed"),
                                    this;
                        o.push({
                            handler: e,
                            context: i
                        })
                    } else
                        o.push({
                            handler: e,
                            context: i
                        })
                }
                return this
            }
            ,
            i.addEventListener = function() {
                return this.on.apply(this, arguments)
            }
            ,
            i.once = function(t, e, i) {
                if (!P(t)) {
                    var n = {};
                    for (var r in t)
                        t.hasOwnProperty(r) && (n[r] = this._wrapOnceHandler(r, t[r], i));
                    return this._switch("on", n)
                }
                for (var o = t.split(" "), s = 0, a = o.length; s < a; s++)
                    this.on(o[s], this._wrapOnceHandler(o[s], e, i));
                return this
            }
            ,
            i.off = function(t, e, i) {
                if (!this._eventMap || !t)
                    return this;
                if (!P(t))
                    return this._switch("off", t, e);
                if (!e)
                    return this;
                if (!G(e._id))
                    return this;
                var n, r, o, s = t.split(" ");
                i || (i = this);
                for (var a = 0, h = s.length; a < h; a++)
                    if (o = Vn(n = s[a].toLowerCase()),
                    r = this._eventMap[n]) {
                        for (var l = r.length - 1; 0 <= l; l--) {
                            var u = r[l];
                            e !== u.handler && e !== u.handler[o] || u.context !== i || (delete u.handler[o],
                            r.splice(l, 1))
                        }
                        r.length || delete this._eventMap[n]
                    }
                return this
            }
            ,
            i.removeEventListener = function() {
                return this.off.apply(this, arguments)
            }
            ,
            i.listens = function(t, e, i) {
                if (!this._eventMap || !P(t))
                    return 0;
                var n = this._eventMap[t.toLowerCase()];
                if (!n || !n.length)
                    return 0;
                if (!e)
                    return n.length;
                for (var r = 0, o = n.length; r < o; r++)
                    if (e === n[r].handler && (ut(i) || n[r].context === i))
                        return 1;
                return 0
            }
            ,
            i.getListeningEvents = function() {
                return this._eventMap ? Object.keys(this._eventMap) : []
            }
            ,
            i.copyEventListeners = function(t) {
                var e, i = t._eventMap;
                if (!i)
                    return this;
                for (var n in i)
                    for (var r = 0, o = (e = i[n]).length; r < o; r++)
                        this.on(n, e[r].handler, e[r].context);
                return this
            }
            ,
            i.fire = function() {
                return this._eventParent ? this._eventParent.fire.apply(this._eventParent, arguments) : this._fire.apply(this, arguments)
            }
            ,
            i._wrapOnceHandler = function(t, e, i) {
                var n = Vn(t)
                  , r = !1
                  , o = function() {
                    r || (delete o[n],
                    r = !0,
                    i ? e.apply(i, arguments) : e.apply(this, arguments),
                    !0)
                };
                return o[n] = e,
                o
            }
            ,
            i._switch = function(t, e, i) {
                for (var n in e)
                    e.hasOwnProperty(n) && this[t](n, e[n], i);
                return this
            }
            ,
            i._clearListeners = function(t) {
                this._eventMap && P(t) && (this._eventMap[t.toLowerCase()] && (this._eventMap[t] = null))
            }
            ,
            i._clearAllListeners = function() {
                this._eventMap = null
            }
            ,
            i._setEventParent = function(t) {
                return this._eventParent = t,
                this
            }
            ,
            i._setEventTarget = function(t) {
                return this._eventTarget = t,
                this
            }
            ,
            i._fire = function(t, e) {
                if (!this._eventMap)
                    return this;
                t = t.toLowerCase();
                var i = this._eventMap[t];
                if (!i)
                    return this;
                e || (e = {}),
                e.type = t,
                e.target = this._eventTarget || this;
                for (var n, r, o = i.slice(0), s = 0, a = o.length; s < a; s++) {
                    if (o[s])
                        o[s].handler._called || (n = o[s].context,
                        !0,
                        r = F({}, e),
                        !1 === (n ? o[s].handler.call(n, r) : o[s].handler(r)) && e.domEvent && wi(e.domEvent))
                }
                var h = this._eventMap[t];
                if (h) {
                    for (var l = [], u = 0, c = h.length; u < c; u++) {
                        h[u].handler._called || l.push(h[u])
                    }
                    this._eventMap[t] = l
                }
                return this
            }
            ,
            e
        }(t)
    }
      , Jn = Un(function() {
        function t(t) {
            this.target = t
        }
        var e = t.prototype;
        return e.enable = function() {
            return this._enabled || (this._enabled = !0,
            this.addHooks()),
            this
        }
        ,
        e.disable = function() {
            return this._enabled && (this._enabled = !1,
            this.removeHooks()),
            this
        }
        ,
        e.enabled = function() {
            return !!this._enabled
        }
        ,
        e.remove = function() {
            this.disable(),
            delete this.target,
            delete this.dom
        }
        ,
        t
    }())
      , qn = function() {
        function t(t) {
            if (!this || !this.setOptions)
                throw new Error('Class instance is being created without "new" operator.');
            this.setOptions(t),
            this.callInitHooks(),
            this._isUpdatingOptions = !1
        }
        var e = t.prototype;
        return e.proxyOptions = function() {
            var r = this;
            return $.proxy && (this.options.isExtensible || (this.options = new Proxy(this.options,{
                set: function(t, e, i) {
                    if (t[e] === i)
                        return !0;
                    if (t[e] = i,
                    r._isUpdatingOptions)
                        return !0;
                    var n = {};
                    return n[e] = i,
                    r.config(n),
                    !0
                }
            }))),
            this
        }
        ,
        e.callInitHooks = function() {
            var t = Object.getPrototypeOf(this);
            return this._visitInitHooks(t),
            this
        }
        ,
        e.setOptions = function(t) {
            if (this.hasOwnProperty("options") || (this.options = this.options ? Object.create(this.options) : {}),
            !t)
                return this;
            for (var e in t)
                this.options[e] = t[e];
            return this
        }
        ,
        e.config = function(t) {
            if (this._isUpdatingOptions = !0,
            !t) {
                var e = {};
                for (var i in this.options)
                    this.options.hasOwnProperty(i) && (e[i] = this.options[i]);
                return this._isUpdatingOptions = !1,
                e
            }
            if (2 === arguments.length) {
                var n = {};
                n[t] = arguments[1],
                t = n
            }
            for (var r in t)
                this.options[r] = t[r],
                this[r] && this[r]instanceof Jn && (t[r] ? this[r].enable() : this[r].disable());
            return this.onConfig(t),
            this._isUpdatingOptions = !1,
            this
        }
        ,
        e.onConfig = function() {}
        ,
        e._visitInitHooks = function(t) {
            if (!this._initHooksCalled) {
                var e = Object.getPrototypeOf(t);
                e._visitInitHooks && e._visitInitHooks.call(this, e),
                this._initHooksCalled = !0;
                var i = t._initHooks;
                if (i && i !== e._initHooks)
                    for (var n = 0; n < i.length; n++)
                        i[n].call(this)
            }
        }
        ,
        t.addInitHook = function(t) {
            for (var e = arguments.length, i = new Array(1 < e ? e - 1 : 0), n = 1; n < e; n++)
                i[n - 1] = arguments[n];
            var r = "function" == typeof t ? t : function() {
                this[t].apply(this, i)
            }
              , o = this.prototype
              , s = Object.getPrototypeOf(o);
            return o._initHooks && o._initHooks !== s._initHooks || (o._initHooks = []),
            o._initHooks.push(r),
            this
        }
        ,
        t.include = function() {
            for (var t = 0; t < arguments.length; t++)
                F(this.prototype, t < 0 || arguments.length <= t ? void 0 : arguments[t]);
            return this
        }
        ,
        t.mergeOptions = function(t) {
            var e = this.prototype
              , i = Object.getPrototypeOf(e);
            return e.options && e.options !== i.options || (e.options = e.options ? Object.create(e.options) : {}),
            F(e.options, t),
            this
        }
        ,
        t
    }()
      , Xn = new (function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        return it(e, t),
        e
    }(Un(function() {})))
      , Yn = "dprchange"
      , Qn = "docvisibilitychange"
      , Kn = "dragstart"
      , $n = "dragend";
    if ("undefined" != typeof window && window.matchMedia)
        for (var tr = 1; tr < 500; tr++) {
            var er = (.01 * tr).toFixed(2)
              , ir = window.matchMedia("screen and (resolution: " + er + "dppx)");
            ir && (ir.addEventListener ? ir.addEventListener("change", $.checkDevicePixelRatio) : ir.addListener && ir.addListener($.checkDevicePixelRatio))
        }
    if ($.devicePixelRatio) {
        var nr = $.devicePixelRatio;
        Object.defineProperty($, "devicePixelRatio", {
            get: function() {
                return nr
            },
            set: function(t) {
                t !== nr && (nr = t,
                $.monitorDPRChange && Xn.fire(Yn, {
                    devicePixelRatio: t
                }))
            }
        })
    }
    $.webgl && "undefined" != typeof document && (_i(document, "visibilitychange", function() {
        Xn.fire(Qn, {
            visibilityState: document.visibilityState
        })
    }),
    _i(document, "dragstart", function() {
        Xn.fire(Kn)
    }),
    _i(document, "dragend", function() {
        Xn.fire($n)
    }));
    var rr = {}
      , or = function(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            return it(e, t),
            e.registerJSONType = function(t) {
                return t ? rr[t] ? (console.error(t + " has register. please use Different name for:", this),
                this) : rr[t] = this : this
            }
            ,
            e.getJSONClass = function(t) {
                return t ? rr[t] : null
            }
            ,
            e.prototype.getJSONType = function() {
                if (void 0 === this._jsonType) {
                    var t = Object.getPrototypeOf(this).constructor;
                    for (var e in rr)
                        if (rr[e] === t) {
                            this._jsonType = e;
                            break
                        }
                }
                if (!this._jsonType)
                    throw new Error("Found an unregistered Layer/Geometry class!");
                return this._jsonType
            }
            ,
            e
        }(t)
    }
      , sr = Bi(function(t, e) {
        t.exports = function() {
            function m(t, e, i) {
                var n = t[e];
                t[e] = t[i],
                t[i] = n
            }
            function o(t, e) {
                return t < e ? -1 : e < t ? 1 : 0
            }
            return function(t, e, i, n, r) {
                !function t(e, i, n, r, o) {
                    for (; n < r; ) {
                        if (600 < r - n) {
                            var s = r - n + 1
                              , a = i - n + 1
                              , h = Math.log(s)
                              , l = .5 * Math.exp(2 * h / 3)
                              , u = .5 * Math.sqrt(h * l * (s - l) / s) * (a - s / 2 < 0 ? -1 : 1)
                              , c = Math.max(n, Math.floor(i - a * l / s + u))
                              , d = Math.min(r, Math.floor(i + (s - a) * l / s + u));
                            t(e, i, c, d, o)
                        }
                        var f = e[i]
                          , g = n
                          , p = r;
                        for (m(e, n, i),
                        0 < o(e[r], f) && m(e, n, r); g < p; ) {
                            for (m(e, g, p),
                            g++,
                            p--; o(e[g], f) < 0; )
                                g++;
                            for (; 0 < o(e[p], f); )
                                p--
                        }
                        0 === o(e[n], f) ? m(e, n, p) : m(e, ++p, r),
                        p <= i && (n = p + 1),
                        i <= p && (r = p - 1)
                    }
                }(t, e, i || 0, n || t.length - 1, r || o)
            }
        }()
    })
      , ar = lr
      , hr = lr;
    function lr(t, e) {
        if (!(this instanceof lr))
            return new lr(t,e);
        this._maxEntries = Math.max(4, t || 9),
        this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)),
        e && this._initFormat(e),
        this.clear()
    }
    function ur(t, e, i) {
        if (!i)
            return e.indexOf(t);
        for (var n = 0; n < e.length; n++)
            if (i(t, e[n]))
                return n;
        return -1
    }
    function cr(t, e) {
        dr(t, 0, t.children.length, e, t)
    }
    function dr(t, e, i, n, r) {
        r || (r = xr(null)),
        r.minX = 1 / 0,
        r.minY = 1 / 0,
        r.maxX = -1 / 0,
        r.maxY = -1 / 0;
        for (var o, s = e; s < i; s++)
            o = t.children[s],
            fr(r, t.leaf ? n(o) : o);
        return r
    }
    function fr(t, e) {
        return t.minX = Math.min(t.minX, e.minX),
        t.minY = Math.min(t.minY, e.minY),
        t.maxX = Math.max(t.maxX, e.maxX),
        t.maxY = Math.max(t.maxY, e.maxY),
        t
    }
    function gr(t, e) {
        return t.minX - e.minX
    }
    function pr(t, e) {
        return t.minY - e.minY
    }
    function mr(t) {
        return (t.maxX - t.minX) * (t.maxY - t.minY)
    }
    function _r(t) {
        return t.maxX - t.minX + (t.maxY - t.minY)
    }
    function vr(t, e) {
        return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY
    }
    function yr(t, e) {
        return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY
    }
    function xr(t) {
        return {
            children: t,
            height: 1,
            leaf: !0,
            minX: 1 / 0,
            minY: 1 / 0,
            maxX: -1 / 0,
            maxY: -1 / 0
        }
    }
    function wr(t, e, i, n, r) {
        for (var o, s = [e, i]; s.length; )
            (i = s.pop()) - (e = s.pop()) <= n || (o = e + Math.ceil((i - e) / n / 2) * n,
            sr(t, o, e, i, r),
            s.push(e, o, o, i))
    }
    lr.prototype = {
        all: function() {
            return this._all(this.data, [])
        },
        search: function(t) {
            var e = this.data
              , i = []
              , n = this.toBBox;
            if (!yr(t, e))
                return i;
            for (var r, o, s, a, h = []; e; ) {
                for (r = 0,
                o = e.children.length; r < o; r++)
                    s = e.children[r],
                    yr(t, a = e.leaf ? n(s) : s) && (e.leaf ? i.push(s) : vr(t, a) ? this._all(s, i) : h.push(s));
                e = h.pop()
            }
            return i
        },
        collides: function(t) {
            var e = this.data
              , i = this.toBBox;
            if (!yr(t, e))
                return !1;
            for (var n, r, o, s, a = []; e; ) {
                for (n = 0,
                r = e.children.length; n < r; n++)
                    if (o = e.children[n],
                    yr(t, s = e.leaf ? i(o) : o)) {
                        if (e.leaf || vr(t, s))
                            return !0;
                        a.push(o)
                    }
                e = a.pop()
            }
            return !1
        },
        load: function(t) {
            if (!t || !t.length)
                return this;
            if (t.length < this._minEntries) {
                for (var e = 0, i = t.length; e < i; e++)
                    this.insert(t[e]);
                return this
            }
            var n = this._build(t.slice(), 0, t.length - 1, 0);
            if (this.data.children.length)
                if (this.data.height === n.height)
                    this._splitRoot(this.data, n);
                else {
                    if (this.data.height < n.height) {
                        var r = this.data;
                        this.data = n,
                        n = r
                    }
                    this._insert(n, this.data.height - n.height - 1, !0)
                }
            else
                this.data = n;
            return this
        },
        insert: function(t) {
            return t && this._insert(t, this.data.height - 1),
            this
        },
        clear: function() {
            return this.data = xr([]),
            this
        },
        remove: function(t, e) {
            if (!t)
                return this;
            for (var i, n, r, o, s = this.data, a = this.toBBox(t), h = [], l = []; s || h.length; ) {
                if (s || (s = h.pop(),
                n = h[h.length - 1],
                i = l.pop(),
                o = !0),
                s.leaf && -1 !== (r = ur(t, s.children, e)))
                    return s.children.splice(r, 1),
                    h.push(s),
                    this._condense(h),
                    this;
                o || s.leaf || !vr(s, a) ? n ? (i++,
                s = n.children[i],
                o = !1) : s = null : (h.push(s),
                l.push(i),
                i = 0,
                s = (n = s).children[0])
            }
            return this
        },
        toBBox: function(t) {
            return t
        },
        compareMinX: gr,
        compareMinY: pr,
        toJSON: function() {
            return this.data
        },
        fromJSON: function(t) {
            return this.data = t,
            this
        },
        _all: function(t, e) {
            for (var i = []; t; )
                t.leaf ? e.push.apply(e, t.children) : i.push.apply(i, t.children),
                t = i.pop();
            return e
        },
        _build: function(t, e, i, n) {
            var r, o = i - e + 1, s = this._maxEntries;
            if (o <= s)
                return cr(r = xr(t.slice(e, i + 1)), this.toBBox),
                r;
            n || (n = Math.ceil(Math.log(o) / Math.log(s)),
            s = Math.ceil(o / Math.pow(s, n - 1))),
            (r = xr([])).leaf = !1,
            r.height = n;
            var a, h, l, u, c = Math.ceil(o / s), d = c * Math.ceil(Math.sqrt(s));
            for (wr(t, e, i, d, this.compareMinX),
            a = e; a <= i; a += d)
                for (wr(t, a, l = Math.min(a + d - 1, i), c, this.compareMinY),
                h = a; h <= l; h += c)
                    u = Math.min(h + c - 1, l),
                    r.children.push(this._build(t, h, u, n - 1));
            return cr(r, this.toBBox),
            r
        },
        _chooseSubtree: function(t, e, i, n) {
            for (var r, o, s, a, h, l, u, c, d, f; n.push(e),
            !e.leaf && n.length - 1 !== i; ) {
                for (u = c = 1 / 0,
                r = 0,
                o = e.children.length; r < o; r++)
                    h = mr(s = e.children[r]),
                    d = t,
                    f = s,
                    (l = (Math.max(f.maxX, d.maxX) - Math.min(f.minX, d.minX)) * (Math.max(f.maxY, d.maxY) - Math.min(f.minY, d.minY)) - h) < c ? (c = l,
                    u = h < u ? h : u,
                    a = s) : l === c && h < u && (u = h,
                    a = s);
                e = a || e.children[0]
            }
            return e
        },
        _insert: function(t, e, i) {
            var n = this.toBBox
              , r = i ? t : n(t)
              , o = []
              , s = this._chooseSubtree(r, this.data, e, o);
            for (s.children.push(t),
            fr(s, r); 0 <= e && o[e].children.length > this._maxEntries; )
                this._split(o, e),
                e--;
            this._adjustParentBBoxes(r, o, e)
        },
        _split: function(t, e) {
            var i = t[e]
              , n = i.children.length
              , r = this._minEntries;
            this._chooseSplitAxis(i, r, n);
            var o = this._chooseSplitIndex(i, r, n)
              , s = xr(i.children.splice(o, i.children.length - o));
            s.height = i.height,
            s.leaf = i.leaf,
            cr(i, this.toBBox),
            cr(s, this.toBBox),
            e ? t[e - 1].children.push(s) : this._splitRoot(i, s)
        },
        _splitRoot: function(t, e) {
            this.data = xr([t, e]),
            this.data.height = t.height + 1,
            this.data.leaf = !1,
            cr(this.data, this.toBBox)
        },
        _chooseSplitIndex: function(t, e, i) {
            var n, r, o, s, a, h, l, u, c, d, f, g, p, m;
            for (h = l = 1 / 0,
            n = e; n <= i - e; n++)
                r = dr(t, 0, n, this.toBBox),
                o = dr(t, n, i, this.toBBox),
                c = r,
                d = o,
                void 0,
                f = Math.max(c.minX, d.minX),
                g = Math.max(c.minY, d.minY),
                p = Math.min(c.maxX, d.maxX),
                m = Math.min(c.maxY, d.maxY),
                s = Math.max(0, p - f) * Math.max(0, m - g),
                a = mr(r) + mr(o),
                s < h ? (h = s,
                u = n,
                l = a < l ? a : l) : s === h && a < l && (l = a,
                u = n);
            return u
        },
        _chooseSplitAxis: function(t, e, i) {
            var n = t.leaf ? this.compareMinX : gr
              , r = t.leaf ? this.compareMinY : pr;
            this._allDistMargin(t, e, i, n) < this._allDistMargin(t, e, i, r) && t.children.sort(n)
        },
        _allDistMargin: function(t, e, i, n) {
            t.children.sort(n);
            var r, o, s = this.toBBox, a = dr(t, 0, e, s), h = dr(t, i - e, i, s), l = _r(a) + _r(h);
            for (r = e; r < i - e; r++)
                o = t.children[r],
                fr(a, t.leaf ? s(o) : o),
                l += _r(a);
            for (r = i - e - 1; e <= r; r--)
                o = t.children[r],
                fr(h, t.leaf ? s(o) : o),
                l += _r(h);
            return l
        },
        _adjustParentBBoxes: function(t, e, i) {
            for (var n = i; 0 <= n; n--)
                fr(e[n], t)
        },
        _condense: function(t) {
            for (var e, i = t.length - 1; 0 <= i; i--)
                0 === t[i].children.length ? 0 < i ? (e = t[i - 1].children).splice(e.indexOf(t[i]), 1) : this.clear() : cr(t[i], this.toBBox)
        },
        _initFormat: function(t) {
            var e = ["return a", " - b", ";"];
            this.compareMinX = new Function("a","b",e.join(t[0])),
            this.compareMinY = new Function("a","b",e.join(t[1])),
            this.toBBox = new Function("a","return {minX: a" + t[0] + ", minY: a" + t[1] + ", maxX: a" + t[2] + ", maxY: a" + t[3] + "};")
        }
    },
    ar.default = hr;
    var Cr = {}
      , br = function() {
        function t() {
            this._tree = ar(9, ["[0]", "[1]", "[2]", "[3]"])
        }
        var e = t.prototype;
        return e.collides = function(t) {
            return Cr.minX = t[0],
            Cr.minY = t[1],
            Cr.maxX = t[2],
            Cr.maxY = t[3],
            this._tree.collides(Cr)
        }
        ,
        e.insertBox = function(t) {
            return this._tree.insert(t),
            this
        }
        ,
        e.bulkInsertBox = function(t) {
            return this._tree.load(t),
            this
        }
        ,
        e.clear = function() {
            return this._tree.clear(),
            this
        }
        ,
        t
    }();
    function Pr(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            it(e, t);
            var i = e.prototype;
            return i.addHandler = function(t, e) {
                if (!e)
                    return this;
                if (this._handlers || (this._handlers = []),
                this[t])
                    return this[t].enable(),
                    this;
                var i = this[t] = new e(this);
                return this._handlers.push(i),
                this.options[t] && i.enable(),
                this
            }
            ,
            i.removeHandler = function(t) {
                if (!t)
                    return this;
                var e = this[t];
                if (e) {
                    var i = this._handlers.indexOf(e);
                    0 <= i && this._handlers.splice(i, 1),
                    this[t].remove(),
                    delete this[t]
                }
                return this
            }
            ,
            i._clearHandlers = function() {
                for (var t = 0, e = this._handlers.length; t < e; t++)
                    this._handlers[t].remove();
                this._handlers = []
            }
            ,
            e
        }(t)
    }
    var Mr = "touchstart mousedown"
      , Tr = {
        mousedown: "mousemove",
        touchstart: "touchmove",
        pointerdown: "touchmove",
        MSPointerDown: "touchmove"
    }
      , Sr = {
        mousedown: "mouseup",
        touchstart: "touchend",
        pointerdown: "touchend",
        MSPointerDown: "touchend"
    }
      , Er = function(n) {
        function t(t, e) {
            var i;
            return void 0 === e && (e = {}),
            (i = n.call(this, null) || this).dom = t,
            i.options = e,
            i
        }
        it(t, n);
        var e = t.prototype;
        return e.enable = function() {
            return this.dom && (this._onMouseDown = function(t) {
                return this.onMouseDown(t)
            }
            ,
            Ii(this.dom, Mr, this._onMouseDown, this)),
            this
        }
        ,
        e.disable = function() {
            return this.dom && (this._offEvents(),
            zi(this.dom, Mr, this._onMouseDown),
            delete this._onMouseDown),
            this
        }
        ,
        e.onMouseDown = function(t) {
            if ((this.options.rightclick || 2 !== t.button) && !(t.touches && 1 < t.touches.length || this.options.cancelOn && !0 === this.options.cancelOn(t))) {
                var e = this.dom;
                e.setCapture ? e.setCapture() : window.captureEvents && window.captureEvents(window.Event.MOUSEMOVE | window.Event.MOUSEUP),
                e.ondragstart = function() {
                    return !1
                }
                ,
                delete this.moved;
                var i = t.touches ? t.touches[0] : t;
                this.startPos = new dt(i.clientX,i.clientY),
                zi(document, Tr[t.type], this.onMouseMove, this),
                zi(document, Sr[t.type], this.onMouseUp, this),
                Ii(document, Tr[t.type], this.onMouseMove, this),
                Ii(document, Sr[t.type], this.onMouseUp, this),
                this.options.ignoreMouseleave || (zi(this.dom, "mouseleave", this.onMouseUp, this),
                Ii(this.dom, "mouseleave", this.onMouseUp, this)),
                this.fire("mousedown", {
                    domEvent: t,
                    mousePos: new dt(i.clientX,i.clientY)
                })
            }
        }
        ,
        e.onMouseMove = function(t) {
            if (t.touches && 1 < t.touches.length)
                this.moved && (this.interupted = !0,
                this.onMouseUp(t));
            else {
                var e = t.touches ? t.touches[0] : t
                  , i = new dt(e.clientX,e.clientY).sub(this.startPos);
                (i.x || i.y) && (this.moved ? this.fire("dragging", {
                    domEvent: t,
                    mousePos: new dt(e.clientX,e.clientY)
                }) : (this.fire("dragstart", {
                    domEvent: t,
                    mousePos: this.startPos.copy()
                }),
                this.moved = !0))
            }
        }
        ,
        e.onMouseUp = function(t) {
            var e = t.changedTouches ? t.changedTouches[0] : t;
            this._offEvents();
            var i = {
                domEvent: t
            };
            G(e.clientX) && (i.mousePos = new dt(parseInt(e.clientX, 0),parseInt(e.clientY, 0))),
            this.moved && (i.interupted = this.interupted,
            this.fire("dragend", i),
            delete this.interupted,
            delete this.moved),
            this.fire("mouseup", i)
        }
        ,
        e._offEvents = function() {
            var t = this.dom;
            if (zi(t, "mouseleave", this.onMouseUp, this),
            "undefined" != typeof document && "undefined" != typeof window) {
                for (var e in Tr)
                    zi(document, Tr[e], this.onMouseMove, this),
                    zi(document, Sr[e], this.onMouseUp, this);
                t.releaseCapture ? t.releaseCapture() : window.captureEvents && window.captureEvents(window.Event.MOUSEMOVE | window.Event.MOUSEUP)
            }
        }
        ,
        t
    }(Jn)
      , Rr = function(t) {
        function o() {
            return t.apply(this, arguments) || this
        }
        return it(o, t),
        o.toNumberArrays = function(t) {
            return Array.isArray(t) ? wt(t, function(t) {
                return [t.x, t.y]
            }) : [t.x, t.y]
        }
        ,
        o.toCoordinates = function(t) {
            if (G(t[0]) && G(t[1]))
                return new o(t);
            if (t instanceof o)
                return t;
            for (var e = [], i = 0, n = t.length; i < n; i++) {
                var r = t[i];
                Array.isArray(r) ? G(r[0]) ? e.push(new o(r)) : e.push(o.toCoordinates(r)) : r instanceof o ? e.push(r) : e.push(new o(r))
            }
            return e
        }
        ,
        o
    }(ct)
      , Ar = function() {
        function e(t, e) {
            this.type = t,
            this.properties = e
        }
        return e.createProj4 = function(t) {
            return new e("proj4",{
                proj: t
            })
        }
        ,
        e.fromProjectionCode = function(t) {
            return t && e[t = t.toUpperCase().replace(":", "")] || null
        }
        ,
        e
    }();
    Ar.WGS84 = Ar.createProj4("+proj=longlat +datum=WGS84 +no_defs"),
    Ar.EPSG4326 = Ar.WGS84,
    Ar.EPSG3857 = Ar.createProj4("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"),
    Ar.IDENTITY = Ar.createProj4("+proj=identity +no_defs"),
    Ar.CGCS2000 = Ar.createProj4("+proj=longlat +datum=CGCS2000"),
    Ar.EPSG4490 = Ar.CGCS2000,
    Ar.BD09LL = Ar.createProj4("+proj=longlat +datum=BD09"),
    Ar.GCJ02 = Ar.createProj4("+proj=longlat +datum=GCJ02");
    var kr, Or = new dt(0,0), Lr = new Rr(0,0), Dr = new Rr(0,0), Ir = new Rr(0,0), zr = new Rr(0,0), jr = new Rr(0,0), Fr = new Rr(0,0), Gr = new Rr(0,0), Hr = new Rr(0,0), Br = [], Nr = [], Zr = function() {
        function t(t, e, i, n) {
            this._clazz = Rr;
            var r = arguments.length
              , o = 0 < r ? arguments[r - 1] : null;
            o && o.unproject && (this.projection = arguments[r - 1]),
            this._dirty = !0,
            this._initialize(t, e, i, n)
        }
        var e = t.prototype;
        return e._initialize = function(t, e, i, n) {
            if (this.xmin = null,
            this.xmax = null,
            this.ymin = null,
            this.ymax = null,
            !ut(t)) {
                var r = this.projection;
                G(t) && G(e) && G(i) && G(n) ? r ? this.set(t, e, i, n) : this.set(Math.min(t, i), Math.min(e, n), Math.max(t, i), Math.max(e, n)) : Array.isArray(t) ? r ? this.set(t[0], t[1], t[2], t[3]) : this.set(Math.min(t[0], t[2]), Math.min(t[1], t[3]), Math.max(t[0], t[2]), Math.max(t[1], t[3])) : G(t.x) && G(e.x) && G(t.y) && G(e.y) ? r ? this.set(t.x, t.y, e.x, e.y) : (t.x > e.x ? (this.xmin = e.x,
                this.xmax = t.x) : (this.xmin = t.x,
                this.xmax = e.x),
                t.y > e.y ? (this.ymin = e.y,
                this.ymax = t.y) : (this.ymin = t.y,
                this.ymax = e.y)) : G(t.xmin) && G(t.xmax) && G(t.ymin) && G(t.ymax) && this.set(t.xmin, t.ymin, t.xmax, t.ymax)
            }
        }
        ,
        e._add = function(t) {
            return this._dirty = !0,
            ut(t.x) ? ut(t.xmin) ? ut(t[0]) || (this.xmin += t[0],
            this.ymin += t[1],
            this.xmax += t[0],
            this.ymax += t[1]) : (this.xmin += t.xmin,
            this.ymin += t.ymin,
            this.xmax += t.xmax,
            this.ymax += t.ymax) : (this.xmin += t.x,
            this.ymin += t.y,
            this.xmax += t.x,
            this.ymax += t.y),
            this
        }
        ,
        e.add = function() {
            var t = new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax,this.projection);
            return t._add.apply(t, arguments)
        }
        ,
        e._scale = function(t) {
            return this._dirty = !0,
            this.xmin *= t,
            this.ymin *= t,
            this.xmax *= t,
            this.ymax *= t,
            this
        }
        ,
        e._sub = function(t) {
            return this._dirty = !0,
            ut(t.x) ? ut(t.xmin) ? ut(t[0]) || (this.xmin -= t[0],
            this.ymin -= t[1],
            this.xmax -= t[0],
            this.ymax -= t[1]) : (this.xmin -= t.xmin,
            this.ymin -= t.ymin,
            this.xmax -= t.xmax,
            this.ymax -= t.ymax) : (this.xmin -= t.x,
            this.ymin -= t.y,
            this.xmax -= t.x,
            this.ymax -= t.y),
            this
        }
        ,
        e._substract = function() {
            return this._sub.apply(this, arguments)
        }
        ,
        e.sub = function() {
            var t = new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax,this.projection);
            return t._sub.apply(t, arguments)
        }
        ,
        e.substract = function() {
            return this.sub.apply(this, arguments)
        }
        ,
        e.round = function() {
            return new this.constructor(Math.round(this.xmin),Math.round(this.ymin),Math.round(this.xmax),Math.round(this.ymax),this.projection)
        }
        ,
        e._round = function() {
            return this._dirty = !0,
            this.xmin = Math.round(this.xmin),
            this.ymin = Math.round(this.ymin),
            this.xmax = Math.round(this.xmax),
            this.ymax = Math.round(this.ymax),
            this
        }
        ,
        e.getMin = function(t) {
            return t ? (t.set(this.xmin, this.ymin),
            t) : new this._clazz(this.xmin,this.ymin)
        }
        ,
        e.getMax = function(t) {
            return t ? (t.set(this.xmax, this.ymax),
            t) : new this._clazz(this.xmax,this.ymax)
        }
        ,
        e.getCenter = function(t) {
            var e = (this.xmin + this.xmax) / 2
              , i = (this.ymin + this.ymax) / 2;
            return t ? (t.set(e, i),
            t) : new this._clazz(e,i)
        }
        ,
        e.isValid = function() {
            return !(ut(this.xmin) || ut(this.ymin) || ut(this.xmax) || ut(this.ymax))
        }
        ,
        e.equals = function(t) {
            return this.xmin === t.xmin && this.xmax === t.xmax && this.ymin === t.ymin && this.ymax === t.ymax
        }
        ,
        e.intersects = function(t) {
            this._project(this),
            this._project(t);
            var e = Math.max(this.pxmin, t.pxmin)
              , i = Math.max(this.pymin, t.pymin)
              , n = Math.min(this.pxmax, t.pxmax)
              , r = Math.min(this.pymax, t.pymax)
              , o = !(n < e || r < i);
            return o
        }
        ,
        e.within = function(t) {
            return this._project(this),
            this._project(t),
            this.pxmin >= t.pxmin && this.pxmax <= t.pxmax && this.pymin >= t.pymin && this.pymax <= t.pymax
        }
        ,
        e.contains = function(t) {
            if (!t)
                return !1;
            this._project(this);
            var e = this.projection;
            if (e)
                if (void 0 !== t.x) {
                    var i = Lr;
                    Array.isArray(t) ? (i.x = t[0],
                    i.y = t[1]) : (i.x = t.x,
                    i.y = t.y),
                    t = e.project(i, i)
                } else
                    void 0 !== t.xmin && this._project(t);
            return (t.x || t.pxmin || 0) >= this.pxmin && (t.x || t.pxmax || 0) <= this.pxmax && (t.y || t.pymin || 0) >= this.pymin && (t.y || t.pymax || 0) <= this.pymax
        }
        ,
        e.getWidth = function() {
            return Math.abs(this.xmax - this.xmin)
        }
        ,
        e.getHeight = function() {
            return Math.abs(this.ymax - this.ymin)
        }
        ,
        e.getSize = function() {
            return new Oe(this.getWidth(),this.getHeight())
        }
        ,
        e.set = function(t, e, i, n) {
            return this.xmin = t,
            this.ymin = e,
            this.xmax = i,
            this.ymax = n,
            this._dirty = !0,
            this
        }
        ,
        e.__combine = function(t) {
            var e, i, n, r;
            void 0 !== t.x && (kr.xmin = kr.xmax = t.x,
            kr.ymin = kr.ymax = t.y,
            t = kr),
            this._project(t),
            this._project(this),
            G(this.pxmin) ? (e = Math.min(this.pxmin, t.pxmin),
            i = Math.min(this.pymin, t.pymin),
            n = Math.max(this.pxmax, t.pxmax),
            r = Math.max(this.pymax, t.pymax)) : (e = t.pxmin,
            i = t.pymin,
            n = t.pxmax,
            r = t.pymax);
            var o = this.projection;
            if (o) {
                Dr.set(e, i),
                Ir.set(n, r);
                var s = o.unproject(Dr, Dr)
                  , a = o.unproject(Ir, Ir);
                e = s.x,
                i = s.y,
                n = a.x,
                r = a.y
            }
            return Nr[0] = e,
            Nr[1] = i,
            Nr[2] = n,
            Nr[3] = r,
            Nr
        }
        ,
        e._combine = function(t) {
            if (!t || t.isValid && !t.isValid())
                return this;
            var e = this.__combine(t);
            return this.set(e[0], e[1], e[2], e[3]),
            this._dirty = !0,
            this
        }
        ,
        e.combine = function(t) {
            if (!t || t.isValid && !t.isValid())
                return this;
            var e = this.__combine(t);
            return new this.constructor(e[0],e[1],e[2],e[3],this.projection)
        }
        ,
        e.intersection = function(t) {
            if (!this.intersects(t))
                return null;
            zr.x = Math.max(this.pxmin, t.pxmin),
            zr.y = Math.max(this.pymin, t.pymin),
            jr.x = Math.min(this.pxmax, t.pxmax),
            jr.y = Math.min(this.pymax, t.pymax);
            var e = zr
              , i = jr
              , n = this.projection;
            return n && (e = n.unproject(e, e),
            i = n.unproject(i, i)),
            new this.constructor(e,i,n)
        }
        ,
        e.expand = function(t) {
            var e, i;
            return G(t) ? e = i = t : (e = t.width || t.x || t[0] || 0,
            i = t.height || t.y || t[1] || 0),
            new this.constructor(this.xmin - e,this.ymin - i,this.xmax + e,this.ymax + i,this.projection)
        }
        ,
        e._expand = function(t) {
            var e, i;
            return G(t) ? e = i = t : (e = t.width || t.x || t[0] || 0,
            i = t.height || t.y || t[1] || 0),
            this.xmin -= e,
            this.ymin -= i,
            this.xmax += e,
            this.ymax += i,
            this._dirty = !0,
            this
        }
        ,
        e.toJSON = function() {
            return {
                xmin: this.xmin,
                ymin: this.ymin,
                xmax: this.xmax,
                ymax: this.ymax
            }
        }
        ,
        e.toArray = function(t) {
            var e = this.xmin
              , i = this.ymin
              , n = this.xmax
              , r = this.ymax;
            return t ? (t[0].x = e,
            t[0].y = r,
            t[1].x = n,
            t[1].y = r,
            t[2].x = n,
            t[2].y = i,
            t[3].x = e,
            t[3].y = i,
            t[4].x = e,
            t[4].y = r,
            t) : [new this._clazz([e, r]), new this._clazz([n, r]), new this._clazz([n, i]), new this._clazz([e, i]), new this._clazz([e, r])]
        }
        ,
        e.toString = function() {
            return this.xmin + "," + this.ymin + "," + this.xmax + "," + this.ymax
        }
        ,
        e.copy = function() {
            return new this.constructor(this.xmin,this.ymin,this.xmax,this.ymax,this.projection)
        }
        ,
        e.convertTo = function(t, e) {
            if (!this.isValid())
                return null;
            var i, n = e || new this.constructor;
            return e && n.set(null, null, null, null),
            this._clazz === Rr ? i = Fr : this._clazz === dt && (i = Or),
            i.x = this.xmin,
            i.y = this.ymax,
            n._combine(t(i)),
            i.x = this.xmax,
            n._combine(t(i)),
            i.y = this.ymin,
            n._combine(t(i)),
            i.x = this.xmin,
            n._combine(t(i)),
            n
        }
        ,
        e._project = function(t) {
            if (t && t.isValid()) {
                var e = this.projection;
                if (e) {
                    if (t._dirty) {
                        Gr.set(t.xmax, t.ymin),
                        Hr.set(t.xmin, t.ymax),
                        Br[0] = Gr,
                        Br[1] = Hr;
                        var i = e.projectCoords(Br)
                          , n = i[0]
                          , r = i[1];
                        t.pxmin = Math.min(n.x, r.x),
                        t.pymin = Math.min(n.y, r.y),
                        t.pxmax = Math.max(n.x, r.x),
                        t.pymax = Math.max(n.y, r.y)
                    }
                    delete t._dirty
                } else
                    t.pxmin = t.xmin,
                    t.pxmax = t.xmax,
                    t.pymin = t.ymin,
                    t.pymax = t.ymax
            } else
                t && (t.pxmin = t.pxmax = t.pymin = t.pymax = null)
        }
        ,
        t
    }();
    kr = new Zr(0,0,0,0);
    var Wr, Vr = function(o) {
        function t(t, e, i, n) {
            var r;
            return (r = o.call(this, t, e, i, n) || this)._clazz = dt,
            r
        }
        return it(t, o),
        t
    }(Zr), Ur = function() {
        function t(t) {
            this.matrix = t
        }
        var e = t.prototype;
        return e.transform = function(t, e, i) {
            var n = this.matrix[0] * (t.x - this.matrix[2]) / e
              , r = -this.matrix[1] * (t.y - this.matrix[3]) / e;
            return i ? (i.x = n,
            i.y = r,
            i) : new dt(n,r)
        }
        ,
        e.untransform = function(t, e, i) {
            var n = t.x * e / this.matrix[0] + this.matrix[2]
              , r = t.y * e / -this.matrix[1] + this.matrix[3];
            return i ? (i.x = n,
            i.y = r,
            i) : new Rr(n,r)
        }
        ,
        t
    }(), Jr = {
        is: function(t) {
            if (this.code === t)
                return !0;
            if (!this.aliases)
                return !1;
            for (var e = 0; e < this.aliases.length; e++)
                if (this.aliases[e] === t)
                    return !0;
            return !1
        },
        project: function() {},
        unproject: function() {},
        projectCoords: function(t, e) {
            var i = this;
            if (!t)
                return [];
            if (!Array.isArray(t))
                return this.project(t);
            if (0 === t.length)
                return [];
            if (!this.isSphere())
                return wt(t, this.project, this);
            if (Array.isArray(t[0]))
                return t.map(function(t) {
                    return i.projectCoords(t, e)
                });
            for (var n, r, o, s, a, h, l = !1 !== e, u = this.getCircum(), c = this.getSphereExtent(), d = c.sx, f = c.sy, g = t[0], p = [this.project(g)], m = 1, _ = t.length; m < _; m++)
                s = (o = t[m]).x - g.x,
                a = o.y - g.y,
                h = this.project(o),
                180 < Math.abs(s) && l && (void 0 === n && (n = o.x > g.x),
                n && (h._add(-u.x * bt(s) * d, 0),
                o._add(-360 * bt(s), 0))),
                90 < Math.abs(a) && l && (void 0 === r && (r = o.y < g.y),
                r && (h._add(0, -u.y * bt(a) * f),
                o._add(0, -180 * bt(a)))),
                g = o,
                p.push(h);
            return p
        },
        unprojectCoords: function(t) {
            return t ? Array.isArray(t) ? wt(t, this.unproject, this) : this.unproject(t) : []
        },
        isSphere: function() {
            return !!this.sphere
        },
        isOutSphere: function(t) {
            return !!this.isSphere() && !this.getSphereExtent().contains(t)
        },
        wrapCoord: function(t) {
            if (!this.isSphere())
                return t;
            var e = this.getSphereExtent()
              , i = new Rr(t);
            return e.contains(i) || (i.x = Mt(t.x, e.xmin, e.xmax),
            i.y = Mt(t.y, e.ymin, e.ymax)),
            i
        },
        getCircum: function() {
            if (!this.circum && this.isSphere()) {
                var t = this.getSphereExtent();
                this.circum = {
                    x: t.getWidth(),
                    y: t.getHeight()
                }
            }
            return this.circum
        },
        getSphereExtent: function() {
            if (!this.extent && this.isSphere()) {
                var t = this.project(new Rr(180,90))
                  , e = this.project(new Rr(-180,-90));
                this.extent = new Zr(e,t,this),
                this.extent.sx = t.x > e.x ? 1 : -1,
                this.extent.sy = t.y > e.y ? 1 : -1
            }
            return this.extent
        }
    }, qr = {
        measureLength: function(t, e) {
            if (!Array.isArray(t))
                return this.measureLenBetween(t, e);
            for (var i = 0, n = 0, r = t.length; n < r - 1; n++)
                i += this.measureLenBetween(t[n], t[n + 1]);
            return i
        }
    }, Xr = F({
        measure: "IDENTITY",
        measureLenBetween: function(t, e) {
            if (!t || !e)
                return 0;
            try {
                return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2))
            } catch (t) {
                return 0
            }
        },
        measureArea: function(t) {
            if (!Array.isArray(t))
                return 0;
            for (var e = 0, i = 0, n = t.length; i < n; i++) {
                var r = t[i]
                  , o = null;
                o = i === n - 1 ? t[0] : t[i + 1],
                e += r.x * o.y - r.y * o.x
            }
            return Math.abs(e / 2)
        },
        locate: function(t, e, i, n) {
            return (n = n || new Rr(0,0)).set(t.x, t.y),
            this._locate(n, e, i)
        },
        _locate: function(t, e, i) {
            return t ? (e || (e = 0),
            i || (i = 0),
            (e || i) && (t.x = t.x + e,
            t.y = t.y + i),
            t) : null
        },
        rotate: function(t, e, i) {
            return t = new Rr(t.x,t.y),
            this._rotate(t, e, i)
        },
        _rotate: (Wr = new dt(0,0),
        function(t, e, i) {
            return Wr.x = t.x - e.x,
            Wr.y = t.y - e.y,
            Wr._rotate(i * Math.PI / 180),
            t.x = e.x + Wr.x,
            t.y = e.y + Wr.y,
            t
        }
        )
    }, qr), Yr = function() {
        function t(t) {
            this.radius = t
        }
        var e = t.prototype;
        return e.measureLenBetween = function(t, e) {
            if (!t || !e)
                return 0;
            var i = w(t.y)
              , n = w(e.y)
              , r = i - n
              , o = w(t.x) - w(e.x);
            return i = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(r / 2), 2) + Math.cos(i) * Math.cos(n) * Math.pow(Math.sin(o / 2), 2))),
            i *= this.radius
        }
        ,
        e.measureArea = function(t) {
            var e, i = w(this.radius), n = 0, r = t, o = r.length;
            if (o < 3)
                return 0;
            for (e = 0; e < o - 1; e++) {
                var s = r[e]
                  , a = r[e + 1];
                n += s.x * i * Math.cos(w(s.y)) * a.y * i - a.x * i * Math.cos(w(a.y)) * s.y * i
            }
            return o = r[e],
            r = r[0],
            n += o.x * i * Math.cos(w(o.y)) * r.y * i - r.x * i * Math.cos(w(r.y)) * o.y * i,
            .5 * Math.abs(n)
        }
        ,
        e.locate = function(t, e, i, n) {
            return (n = n || new Rr(0,0)).set(t.x, t.y),
            this._locate(n, e, i)
        }
        ,
        e._locate = function(t, e, i) {
            if (!t)
                return null;
            if (e || (e = 0),
            i || (i = 0),
            !e && !i)
                return t;
            var n, r, o = w(t.y);
            if (0 !== i) {
                var s = Math.abs(i);
                r = Mt(180 * (o += 2 * Math.sin(s / (2 * this.radius)) * (0 < i ? 1 : -1)) / Math.PI, -90, 90)
            } else
                r = t.y;
            if (0 !== e) {
                var a = Math.abs(e)
                  , h = w(t.x);
                n = Mt(180 * (h += 2 * Math.sqrt(Math.pow(Math.sin(a / (2 * this.radius)), 2) / Math.pow(Math.cos(o), 2)) * (0 < e ? 1 : -1)) / Math.PI, -180, 180)
            } else
                n = t.x;
            return t.x = n,
            t.y = r,
            t
        }
        ,
        e.rotate = function(t, e, i) {
            return t = new Rr(t),
            this._rotate(t, e, i)
        }
        ,
        e._rotate = function(t, e, i) {
            var n = function(t, e, i) {
                void 0 === i && (i = {});
                var n;
                n = i.final ? Qr(e, t) : Qr(t, e);
                return 180 < n ? -(360 - n) : n
            }(e, t) - i
              , r = this.measureLenBetween(e, t);
            return t.x = e.x,
            t.y = e.y,
            function(t, e, i, n) {
                var r = e / n
                  , o = t.x * Math.PI / 180
                  , s = w(t.y)
                  , a = w(i)
                  , h = r * Math.cos(a)
                  , l = s + h;
                Math.abs(l) > Math.PI / 2 && (l = 0 < l ? Math.PI - l : -Math.PI - l);
                var u = Math.log(Math.tan(l / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4))
                  , c = 1e-11 < Math.abs(u) ? h / u : Math.cos(s)
                  , d = r * Math.sin(a) / c
                  , f = o + d;
                return t.x = (180 * f / Math.PI + 540) % 360 - 180,
                t.y = 180 * l / Math.PI,
                t
            }(t, r, n, this.radius)
        }
        ,
        t
    }();
    function Qr(t, e) {
        var i = w(t.y)
          , n = w(e.y)
          , r = w(e.x - t.x);
        r > Math.PI && (r -= 2 * Math.PI),
        r < -Math.PI && (r += 2 * Math.PI);
        var o = Math.log(Math.tan(n / 2 + Math.PI / 4) / Math.tan(i / 2 + Math.PI / 4));
        return (C(Math.atan2(r, o)) + 360) % 360
    }
    var Kr = F({
        measure: "EPSG:4326",
        sphere: new Yr(6378137),
        measureLenBetween: function() {
            return this.sphere.measureLenBetween.apply(this.sphere, arguments)
        },
        measureArea: function() {
            return this.sphere.measureArea.apply(this.sphere, arguments)
        },
        _locate: function() {
            return this.sphere._locate.apply(this.sphere, arguments)
        },
        locate: function() {
            return this.sphere.locate.apply(this.sphere, arguments)
        },
        _rotate: function() {
            return this.sphere._rotate.apply(this.sphere, arguments)
        },
        rotate: function() {
            return this.sphere.rotate.apply(this.sphere, arguments)
        }
    }, qr)
      , $r = F({
        measure: "BAIDU",
        sphere: new Yr(6370996.81),
        measureLenBetween: function() {
            return this.sphere.measureLenBetween.apply(this.sphere, arguments)
        },
        measureArea: function() {
            return this.sphere.measureArea.apply(this.sphere, arguments)
        },
        _locate: function() {
            return this.sphere._locate.apply(this.sphere, arguments)
        },
        locate: function() {
            return this.sphere.locate.apply(this.sphere, arguments)
        },
        _rotate: function() {
            return this.sphere._rotate.apply(this.sphere, arguments)
        },
        rotate: function() {
            return this.sphere.rotate.apply(this.sphere, arguments)
        }
    }, qr)
      , to = Kr
      , eo = {};
    function io(t) {
        eo[t.measure] = t
    }
    io(Xr),
    io(Kr),
    io($r);
    var no = {
        getInstance: function(t) {
            if (!t)
                return to;
            for (var e in eo)
                if (v(eo, e)) {
                    var i = eo[e].measure;
                    if (!i)
                        continue;
                    if (t.toLowerCase() === i.toLowerCase())
                        return eo[e]
                }
            return null
        }
    }
      , ro = Object.freeze({
        Identity: Xr,
        DEFAULT: to,
        Measurer: no,
        WGS84Sphere: Kr,
        BaiduSphere: $r
    })
      , oo = F({}, Jr, {
        code: "EPSG:3857",
        rad: Math.PI / 180,
        metersPerDegree: 6378137 * Math.PI / 180,
        maxLatitude: 85.0511287798,
        project: function(t, e) {
            var i = this.rad
              , n = this.metersPerDegree
              , r = this.maxLatitude
              , o = t.x
              , s = Math.max(Math.min(r, t.y), -r)
              , a = o * n
              , h = (0 === s ? 0 : Math.log(Math.tan((90 + s) * i / 2)) / i) * n;
            return e ? (e.x = a,
            e.y = h,
            e) : new Rr(a,h)
        },
        unproject: function(t, e) {
            var i, n = this.rad, r = this.metersPerDegree, o = t.x / r, s = t.y;
            0 === s ? i = 0 : (i = s / r,
            i = (2 * Math.atan(Math.exp(i * n)) - Math.PI / 2) / n),
            Math.abs(Math.abs(o) - 180) < 1e-7 && (o = 180 * bt(o)),
            Math.abs(Math.abs(i) - this.maxLatitude) < 1e-7 && (i = bt(i) * this.maxLatitude);
            var a = Mt(o, -180, 180)
              , h = Mt(i, -this.maxLatitude, this.maxLatitude);
            return e ? (e.x = a,
            e.y = h,
            e) : new Rr(a,h)
        }
    }, Kr)
      , so = F({}, Jr, {
        code: "EPSG:4326",
        aliases: ["EPSG:4490"],
        project: function(t, e) {
            return e ? (e.x = t.x,
            e.y = t.y,
            e) : new Rr(t)
        },
        unproject: function(t, e) {
            return e ? (e.x = t.x,
            e.y = t.y,
            e) : new Rr(t)
        }
    }, Kr)
      , ao = Math.abs
      , ho = Math.sin
      , lo = Math.cos
      , uo = Math.tan
      , co = Math.atan
      , fo = Math.atan2
      , go = Math.sqrt
      , po = Math.log
      , mo = Math.hypot
      , _o = Math.sinh
      , vo = Math.cosh;
    Math.PI;
    function yo(t) {
        var g, p, e, i, n, r, l = [], m = [], u = [], _ = [];
        function v(t, e) {
            for (var i, n = 2 * lo(2 * e), r = t.length - 1, o = t[r], s = 0; 0 <= --r; )
                i = n * o - s + t[r],
                s = o,
                o = i;
            return e + i * ho(2 * e)
        }
        function y(t, e, i) {
            for (var n, r, o = ho(e), s = lo(e), a = _o(i), h = vo(i), l = 2 * s * h, u = -2 * o * a, c = t.length - 1, d = t[c], f = 0, g = 0, p = 0; 0 <= --c; )
                n = g,
                r = f,
                d = l * (g = d) - n - u * (f = p) + t[c],
                p = u * g - r + l * f;
            return [(l = o * h) * d - (u = s * a) * p, l * p + u * d]
        }
        t.es,
        n = i = (e = t.es / (1 + go(1 - t.es))) / (2 - e),
        l[0] = i * (2 + i * (-2 / 3 + i * (i * (116 / 45 + i * (26 / 45 + i * (-2854 / 675))) - 2))),
        m[0] = i * (i * (2 / 3 + i * (4 / 3 + i * (-82 / 45 + i * (32 / 45 + i * (4642 / 4725))))) - 2),
        n *= i,
        l[1] = n * (7 / 3 + i * (i * (-227 / 45 + i * (2704 / 315 + i * (2323 / 945))) - 1.6)),
        m[1] = n * (5 / 3 + i * (-16 / 15 + i * (-13 / 9 + i * (904 / 315 + i * (-1522 / 945))))),
        n *= i,
        l[2] = n * (56 / 15 + i * (-136 / 35 + i * (-1262 / 105 + i * (73814 / 2835)))),
        m[2] = n * (-26 / 15 + i * (34 / 21 + i * (1.6 + i * (-12686 / 2835)))),
        n *= i,
        l[3] = n * (4279 / 630 + i * (-332 / 35 + i * (-399572 / 14175))),
        m[3] = n * (1237 / 630 + i * (i * (-24832 / 14175) - 2.4)),
        n *= i,
        l[4] = n * (4174 / 315 + i * (-144838 / 6237)),
        m[4] = n * (-734 / 315 + i * (109598 / 31185)),
        n *= i,
        l[5] = n * (601676 / 22275),
        m[5] = n * (444337 / 155925),
        n = i * i,
        g = t.k0 / (1 + i) * (1 + n * (.25 + n * (1 / 64 + n / 256))),
        u[0] = i * (i * (2 / 3 + i * (-37 / 96 + i * (1 / 360 + i * (81 / 512 + i * (-96199 / 604800))))) - .5),
        _[0] = i * (.5 + i * (-2 / 3 + i * (5 / 16 + i * (41 / 180 + i * (-127 / 288 + i * (7891 / 37800)))))),
        u[1] = n * (-1 / 48 + i * (-1 / 15 + i * (437 / 1440 + i * (-46 / 105 + i * (1118711 / 3870720))))),
        _[1] = n * (13 / 48 + i * (i * (557 / 1440 + i * (281 / 630 + i * (-1983433 / 1935360))) - .6)),
        n *= i,
        u[2] = n * (-17 / 480 + i * (37 / 840 + i * (209 / 4480 + i * (-5569 / 90720)))),
        _[2] = n * (61 / 240 + i * (-103 / 140 + i * (15061 / 26880 + i * (167603 / 181440)))),
        n *= i,
        u[3] = n * (-4397 / 161280 + i * (11 / 504 + i * (830251 / 7257600))),
        _[3] = n * (49561 / 161280 + i * (-179 / 168 + i * (6601661 / 7257600))),
        n *= i,
        u[4] = n * (-4583 / 161280 + i * (108847 / 3991680)),
        _[4] = n * (34729 / 80640 + i * (-3418889 / 1995840)),
        n *= i,
        u[5] = -.03233083094085698 * n,
        _[5] = .6650675310896665 * n,
        r = v(m, t.phi0),
        p = -g * (r + function(t, e) {
            var i, n = 2 * lo(e), r = t.length - 1, o = t[r], s = 0;
            for (; 0 <= --r; )
                i = n * o - s + t[r],
                s = o,
                o = i;
            return ho(e) * i
        }(_, 2 * r)),
        t.fwd = function(t, e) {
            var i, n, r, o, s, a = t.phi, h = t.lam;
            a = v(m, a),
            i = ho(a),
            n = lo(a),
            o = ho(h),
            r = lo(h),
            a = fo(i, r * n),
            h = fo(o * n, mo(i, n * r)),
            l = uo(h),
            f = ao(l),
            u = f * (1 + f / (mo(1, f) + 1)),
            f = 0 == (d = (c = 1 + u) - 1) ? u : u * po(c) / d,
            h = l < 0 ? -f : f,
            s = y(_, 2 * a, 2 * h),
            a += s[0],
            h += s[1],
            ao(h) <= 2.623395162778 ? (e.y = g * a + p,
            e.x = g * h) : e.x = e.y = 1 / 0;
            var l, u, c, d, f
        }
        ,
        t.inv = function(t, e) {
            var i, n, r, o, s, a = t.y, h = t.x;
            a = (a - p) / g,
            ao(h /= g) <= 2.623395162778 ? (s = y(u, 2 * a, 2 * h),
            a += s[0],
            h += s[1],
            h = co(_o(h)),
            i = ho(a),
            n = lo(a),
            o = ho(h),
            r = lo(h),
            h = fo(o, r * n),
            a = fo(i * r, mo(o, r * n)),
            e.phi = v(l, a),
            e.lam = h) : e.phi = e.lam = 1 / 0
        }
    }
    var xo = 57.29577951308232
      , wo = .017453292519943295
      , Co = ["Traverse_Mercator"]
      , bo = F({}, Jr, {
        code: "EPSG:9807",
        aliases: Co,
        create: function(t) {
            var r = {
                a: 6378137,
                es: .0066943799901413165,
                x0: ut(t.falseEasting) ? 5e5 : t.falseEasting,
                y0: ut(t.falseNorthing) ? 0 : t.falseNorthing,
                k0: t.scaleFactor || .9996,
                lam0: (t.centralMeridian || 0) * wo,
                phi0: (t.latitudeOfOrigin || 0) * wo,
                originLam0: t.startLongtitude || 0,
                originPhi0: t.startLatitude || 0
            };
            yo(r);
            var o = {
                lam: 0,
                phi: 0
            }
              , s = {}
              , a = 0
              , h = 0;
            return (r.originLam0 || r.originPhi0) && (o.lam = r.originLam0 * wo - r.lam0,
            o.phi = r.originPhi0 * wo,
            r.fwd(o, s),
            a = r.a * s.x + r.x0,
            h = r.a * s.y + r.y0),
            F({}, Jr, {
                code: "EPSG:9807",
                aliases: Co,
                centralMeridian: t.centralMeridian,
                project: function(t, e) {
                    o.lam = t.x * wo - r.lam0,
                    o.phi = t.y * wo,
                    r.fwd(o, s);
                    var i = r.a * s.x + r.x0 - a
                      , n = r.a * s.y + r.y0 - h;
                    return e ? (e.x = i,
                    e.y = n,
                    e) : new Rr(i,n)
                },
                unproject: function(t, e) {
                    s.x = (t.x - r.x0 + a) / r.a,
                    s.y = (t.y - r.y0 + h) / r.a,
                    r.inv(s, o);
                    var i = (o.lam + r.lam0) * xo
                      , n = o.phi * xo;
                    return e ? (e.x = i,
                    e.y = n,
                    e) : new Rr(i,n)
                }
            }, Kr)
        }
    })
      , Po = F({}, bo, {
        code: "utm",
        aliases: [],
        create: function(t) {
            var e = {}
              , i = parseInt(t.zone);
            if (e.falseNorthing = t.south ? 1e7 : 0,
            e.falseEasting = 5e5,
            !(0 < i && i <= 60))
                throw new Error("zone must be > 0 and <= 60.");
            return i--,
            e.centralMeridian = 6 * (i + .5) - 180,
            e.scaleFactor = .9996,
            bo.create(e)
        }
    })
      , Mo = F({}, Jr, {
        code: "BAIDU",
        project: function(t, e) {
            return this.convertLL2MC(t, e)
        },
        unproject: function(t, e) {
            return this.convertMC2LL(t, e)
        }
    }, $r, {
        EARTHRADIUS: 6370996.81,
        MCBAND: [12890594.86, 8362377.87, 5591021, 3481989.83, 1678043.12, 0],
        LLBAND: [75, 60, 45, 30, 15, 0],
        MC2LL: [[1.410526172116255e-8, 898305509648872e-20, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -.03801003308653, 17337981.2], [-7.435856389565537e-9, 8983055097726239e-21, -.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86], [-3.030883460898826e-8, 898305509983578e-20, .30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, .32710905363475, 6856817.37], [-1.981981304930552e-8, 8983055099779535e-21, .03278182852591, 40.31678527705744, .65659298677277, -4.44255534477492, .85341911805263, .12923347998204, -.04625736007561, 4482777.06], [3.09191371068437e-9, 8983055096812155e-21, 6995724062e-14, 23.10934304144901, -.00023663490511, -.6321817810242, -.00663494467273, .03430082397953, -.00466043876332, 2555164.4], [2.890871144776878e-9, 8983055095805407e-21, -3.068298e-8, 7.47137025468032, -353937994e-14, -.02145144861037, -1234426596e-14, .00010322952773, -323890364e-14, 826088.5]],
        LL2MC: [[-.0015702102444, 111320.7020616939, 0x60e374c3105a3, -0x24bb4115e2e164, 0x5cc55543bb0ae8, -0x7ce070193f3784, 0x5e7ca61ddf8150, -0x261a578d8b24d0, 0x665d60f3742ca, 82.5], [.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5], [.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5], [.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5], [-.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5], [-.0003218135878613132, 111320.7020701615, .00369383431289, 823725.6402795718, .46104986909093, 2351.343141331292, 1.58060784298199, 8.77738589078284, .37238884252424, 7.45]],
        convertMC2LL: function(t, e) {
            for (var i, n = 0, r = this.MCBAND.length; n < r; n++)
                if (Math.abs(t.y) >= this.MCBAND[n]) {
                    i = this.MC2LL[n];
                    break
                }
            return this.convertor(t, i, e)
        },
        convertLL2MC: function(t, e) {
            var i, n, r;
            t.x = this.getLoop(t.x, -180, 180),
            t.y = this.getRange(t.y, -74, 74);
            var o = new Rr(t.x,t.y);
            for (n = 0,
            r = this.LLBAND.length; n < r; n++)
                if (o.y >= this.LLBAND[n]) {
                    i = this.LL2MC[n];
                    break
                }
            if (!i)
                for (n = this.LLBAND.length - 1; 0 <= n; n--)
                    if (o.y <= -this.LLBAND[n]) {
                        i = this.LL2MC[n];
                        break
                    }
            return this.convertor(t, i, e)
        },
        convertor: function(t, e, i) {
            if (!t || !e)
                return null;
            var n = e[0] + e[1] * Math.abs(t.x)
              , r = Math.abs(t.y) / e[9]
              , o = e[2] + e[3] * r + e[4] * r * r + e[5] * r * r * r + e[6] * r * r * r * r + e[7] * r * r * r * r * r + e[8] * r * r * r * r * r * r;
            return n *= t.x < 0 ? -1 : 1,
            o *= t.y < 0 ? -1 : 1,
            i ? (i.x = n,
            i.y = o,
            i) : new Rr(n,o)
        },
        toRadians: function(t) {
            return Math.PI * t / 180
        },
        toDegrees: function(t) {
            return 180 * t / Math.PI
        },
        getRange: function(t, e, i) {
            return null != e && (t = Math.max(t, e)),
            null != i && (t = Math.min(t, i)),
            t
        },
        getLoop: function(t, e, i) {
            if (t === 1 / 0)
                return i;
            if (t === -1 / 0)
                return e;
            for (; i < t; )
                t -= i - e;
            for (; t < e; )
                t += i - e;
            return t
        }
    })
      , To = F({}, Jr, {
        code: "IDENTITY",
        project: function(t, e) {
            return e ? (e.x = t.x,
            e.y = t.y,
            e) : t.copy()
        },
        unproject: function(t, e) {
            return e ? (e.x = t.x,
            e.y = t.y,
            e) : t.copy()
        }
    }, Xr)
      , So = oo
      , Eo = Object.freeze({
        EPSG3857: oo,
        DEFAULT: So,
        EPSG4326: so,
        EPSG9807: bo,
        UTM: Po,
        BAIDU: Mo,
        IDENTITY: To,
        Common: Jr
    })
      , Ro = function(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            return it(e, t),
            e.registerRenderer = function(t, e) {
                var i = this.prototype
                  , n = Object.getPrototypeOf(i);
                return i._rendererClasses && i._rendererClasses !== n._rendererClasses || (i._rendererClasses = i._rendererClasses ? Object.create(i._rendererClasses) : {}),
                i._rendererClasses[t.toLowerCase()] = e,
                this
            }
            ,
            e.getRendererClass = function(t) {
                var e = this.prototype;
                return e._rendererClasses ? e._rendererClasses[t.toLowerCase()] : null
            }
            ,
            e
        }(t)
    }
      , Ao = 0
      , ko = []
      , Oo = function() {
        function t(t) {
            var e = this;
            _n(),
            this._delayMessages = [],
            this.initializing = !1;
            var i = qi(t);
            Ui && !i && (this.initializing = !0,
            console.log("Injecting codes in worker with worker key: :" + t),
            nn(t, function() {
                e.initializing = !1,
                e.created()
            })),
            this.workerKey = t,
            this.workerPool = ln(),
            this.currentActor = 0,
            this.actorId = mt(),
            this.workers = this.workerPool.acquire(this.actorId),
            this.callbacks = {},
            this.callbackID = 0,
            this.receiveFn = this.receive.bind(this),
            this.workers.forEach(function(t) {
                t.addEventListener("message", e.receiveFn, !1)
            }),
            Xi(t)
        }
        var e = t.prototype;
        return e.created = function() {
            var s = this;
            this._delayMessages.forEach(function(t) {
                var e = t.command
                  , i = t.data
                  , n = t.buffers
                  , r = t.cb
                  , o = t.workerId;
                s[e](i, n, r, o)
            }),
            this._delayMessages = []
        }
        ,
        e.isActive = function() {
            return !!this.workers
        }
        ,
        e.broadcast = function(i, n, t) {
            var r = this;
            return this.initializing ? this._delayMessages.push({
                command: "broadcast",
                data: i,
                buffers: n,
                cb: t
            }) : (t = t || function() {}
            ,
            function(t, e, n) {
                t.length || n(null, []);
                var r = t.length
                  , o = new Array(t.length)
                  , s = null;
                t.forEach(function(t, i) {
                    e(t, function(t, e) {
                        t && (s = t),
                        o[i] = e,
                        0 == --r && n(s, o)
                    })
                })
            }(this.workers, function(t, e) {
                r.send(i, n, e, t.id)
            }, t)),
            this
        }
        ,
        e.send = function(t, e, i, n) {
            if (this.initializing)
                return this._delayMessages.push({
                    command: "send",
                    data: t,
                    buffers: e,
                    cb: i,
                    workerId: n
                }),
                this;
            var r = i ? this.actorId + ":" + this.callbackID++ : null;
            return i && (this.callbacks[r] = i),
            this.post({
                data: t,
                callback: String(r)
            }, e, n),
            this
        }
        ,
        e.receive = function(t) {
            var r = this
              , o = t.data
              , e = o.callback
              , i = this.callbacks[e];
            delete this.callbacks[e],
            "<request>" === o.type ? this.actorId === o.actorId && this[o.command](o.params, function(t, e, i) {
                var n = {
                    type: "<response>",
                    callback: o.callback
                };
                t ? n.error = t.message : n.data = e,
                r.post(n, i || ko, o.workerId)
            }) : i && o.error ? i(o.error) : i && i(null, o.data)
        }
        ,
        e.remove = function() {
            var e = this;
            this.workers.forEach(function(t) {
                t.removeEventListener("message", e.receiveFn, !1)
            }),
            delete this.receiveFn,
            delete this.workers,
            delete this.callbacks,
            delete this.workerPool
        }
        ,
        e.post = function(t, e, i) {
            return ("number" != typeof i || isNaN(i)) && (i = this.currentActor = (this.currentActor + 1) % this.workerPool.workerCount),
            t.workerId = i,
            t.workerKey = this.workerKey,
            t.actorId = this.actorId,
            this.workerPool.addMessage(i, t, e || ko),
            i
        }
        ,
        e.getDedicatedWorker = function() {
            return Ao = (Ao + 1) % this.workerPool.workerCount
        }
        ,
        t
    }();
    var Lo = []
      , Do = function(t) {
        function e() {
            return t.call(this, Vi) || this
        }
        return it(e, t),
        e.prototype.fetchImage = function(t, e) {
            var i = {
                url: t
            };
            this.send(i, Lo, e)
        }
        ,
        e
    }(Oo)
      , Io = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this) || this).layer = t,
            e._painted = !1,
            e._drawTime = 0,
            !$.decodeImageInWorker || $.safari || $.iosWeixin || (e._resWorkerConn = new Do),
            e.setToRedraw(),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.render = function(t) {
            this.prepareRender(),
            this.getMap() && this.layer.isVisible() && (this.resources || (this.resources = new zo),
            this.checkAndDraw(this._tryToDraw, t),
            this._frameTime = t)
        }
        ,
        e.getFrameTimestamp = function() {
            return this._frameTime || 0
        }
        ,
        e.checkAndDraw = function(t) {
            var e = this;
            this._toRedraw = !1;
            for (var i = arguments.length, n = new Array(1 < i ? i - 1 : 0), r = 1; r < i; r++)
                n[r - 1] = arguments[r];
            if (this.checkResources) {
                var o = this.checkResources();
                0 < o.length ? (this._loadingResource = !0,
                this.loadResources(o).then(function() {
                    if (e._loadingResource = !1,
                    e.layer) {
                        e.layer.fire("resourceload");
                        var t = e.layer.getMap();
                        e.setToRedraw(),
                        t.getRenderer().callInNextFrame(function() {
                            e.setToRedraw()
                        })
                    }
                })) : t.call.apply(t, [this].concat(n))
            } else
                t.call.apply(t, [this].concat(n))
        }
        ,
        e.testIfNeedRedraw = function() {
            var t = this.getMap();
            return !this._loadingResource && (!!this._toRedraw || !(t.isInteracting() && !this.drawOnInteracting) && !!this.needToRedraw())
        }
        ,
        e.needToRedraw = function() {
            var t = this.getMap();
            return !(!t.isInteracting() && !t.getRenderer().isViewChanged()) && !(!t.getPitch() && t.isMoving() && !t.isZooming() && !t.isRotating() && !this.layer.options.forceRenderOnMoving)
        }
        ,
        e.onSkipDrawOnInteracting = function() {}
        ,
        e.isLoadingResource = function() {
            return this._loadingResource
        }
        ,
        e.isRenderComplete = function() {
            return !!this._renderComplete
        }
        ,
        e.mustRenderOnInteracting = function() {
            return !this._painted
        }
        ,
        e.setToRedraw = function() {
            return this._toRedraw = !0,
            this
        }
        ,
        e.setCanvasUpdated = function() {
            return this._canvasUpdated = !0,
            this
        }
        ,
        e.isCanvasUpdated = function() {
            return !!this._canvasUpdated
        }
        ,
        e.remove = function() {
            this.onRemove(),
            delete this._loadingResource,
            delete this.middleWest,
            delete this.canvas,
            delete this.context,
            delete this.canvasExtent2D,
            delete this._extent2D,
            this.resources && this.resources.remove(),
            delete this.resources,
            this._resWorkerConn && (this._resWorkerConn.remove(),
            delete this._resWorkerConn),
            delete this.layer
        }
        ,
        e.onRemove = function() {}
        ,
        e.onAdd = function() {}
        ,
        e.getMap = function() {
            return this.layer ? this.layer.getMap() : null
        }
        ,
        e.getCanvasImage = function() {
            var t = this.getMap();
            if (this._canvasUpdated = !1,
            this._renderZoom !== t.getZoom() || !this.canvas || !this._extent2D)
                return null;
            if (this.isBlank())
                return null;
            if (this.layer.isEmpty && this.layer.isEmpty())
                return null;
            var e = t._pointToContainerPoint(this.middleWest)._add(0, -t.height / 2);
            return {
                image: this.canvas,
                layer: this.layer,
                point: e
            }
        }
        ,
        e.clear = function() {
            this.clearCanvas()
        }
        ,
        e.isBlank = function() {
            return !this._painted
        }
        ,
        e.show = function() {
            this.setToRedraw()
        }
        ,
        e.hide = function() {
            this.clear(),
            this.setToRedraw()
        }
        ,
        e.setZIndex = function() {
            this.setToRedraw()
        }
        ,
        e.hitDetect = function(t) {
            if (!this.context || this.layer.isEmpty && this.layer.isEmpty() || this.isBlank() || this._errorThrown || this.layer.isVisible && !this.layer.isVisible())
                return !1;
            var e = this.getMap()
              , i = e.getDevicePixelRatio()
              , n = e.getSize();
            if (t.x < 0 || t.x > n.width * i || t.y < 0 || t.y > n.height * i)
                return !1;
            var r = this.getImageData && this.getImageData();
            if (r) {
                var o = Math.round(i * t.x)
                  , s = Math.round(i * t.y) * r.width * 4 + 4 * o;
                return 0 < r.data[s + 3]
            }
            try {
                if (0 < this.context.getImageData(i * t.x, i * t.y, 1, 1).data[3])
                    return !0
            } catch (t) {
                return this._errorThrown || (console && console.warn("hit detect failed with tainted canvas, some geometries have external resources in another domain:\n", t),
                this._errorThrown = !0),
                !1
            }
            return !1
        }
        ,
        e.loadResources = function(t) {
            this.resources || (this.resources = new zo);
            var e = this.resources
              , i = [];
            if (St(t))
                for (var n = {}, r = t.length - 1; 0 <= r; r--) {
                    var o = t[r];
                    o && o.length && !n[o.join("-")] && (n[o.join("-")] = 1,
                    e.isResourceLoaded(o, !0) || i.push(new Wi(this._promiseResource(o))))
                }
            return Wi.all(i)
        }
        ,
        e.prepareRender = function() {
            delete this._renderComplete;
            var t = this.getMap();
            this._renderZoom = t.getZoom(),
            this.canvasExtent2D = this._extent2D = t._get2DExtent(),
            this.middleWest = t._containerPointToPoint(new dt(0,t.height / 2))
        }
        ,
        e.createCanvas = function() {
            if (!this.canvas) {
                var t = this.getMap()
                  , e = t.getSize()
                  , i = t.getDevicePixelRatio()
                  , n = Math.round(i * e.width)
                  , r = Math.round(i * e.height);
                if (this.layer._canvas) {
                    var o = this.layer._canvas;
                    o.width = n,
                    o.height = r,
                    o.style && (o.style.width = e.width + "px",
                    o.style.height = e.height + "px"),
                    this.canvas = this.layer._canvas
                } else
                    this.canvas = Gn.createCanvas(n, r, t.CanvasClass);
                this.onCanvasCreate()
            }
        }
        ,
        e.onCanvasCreate = function() {}
        ,
        e.createContext = function() {
            if (!(this.gl && this.gl.canvas === this.canvas || this.context) && (this.context = Gn.getCanvas2DContext(this.canvas),
            this.context)) {
                this.layer.options.globalCompositeOperation && (this.context.globalCompositeOperation = this.layer.options.globalCompositeOperation);
                var t = this.getMap().getDevicePixelRatio();
                1 !== t && this.context.scale(t, t)
            }
        }
        ,
        e.resetCanvasTransform = function() {
            if (this.context) {
                var t = this.getMap().getDevicePixelRatio();
                this.context.setTransform(t, 0, 0, t, 0, 0)
            }
        }
        ,
        e.resizeCanvas = function(t) {
            var e = this.canvas;
            if (e) {
                var i = t || this.getMap().getSize()
                  , n = this.getMap().getDevicePixelRatio()
                  , r = Ut(i, n)
                  , o = r.width
                  , s = r.height
                  , a = r.cssWidth
                  , h = r.cssHeight;
                !this.layer._canvas || e.style.width === a && e.style.height === h || (e.style.width = a,
                e.style.height = h),
                e.width === o && e.height === s || (e.height = s,
                e.width = o,
                1 !== n && this.context && this.context.scale(n, n))
            }
        }
        ,
        e.clearCanvas = function() {
            if (this.context && this.getMap()) {
                var t = 1 / this.getMap().getDevicePixelRatio()
                  , e = this.canvas.width * t
                  , i = this.canvas.height * t;
                Gn.clearRect(this.context, 0, 0, Math.max(e, this.canvas.width), Math.max(i, this.canvas.height))
            }
        }
        ,
        e.prepareCanvas = function() {
            this.canvas ? (this.resetCanvasTransform(),
            this.clearCanvas(),
            this.resizeCanvas()) : (this.createCanvas(),
            this.createContext(),
            this.layer.onCanvasCreate(),
            this.layer.fire("canvascreate", {
                context: this.context,
                gl: this.gl
            })),
            delete this._maskExtent;
            var t = this.layer.getMask();
            if (!t)
                return this.layer.fire("renderstart", {
                    context: this.context,
                    gl: this.gl
                }),
                null;
            var e = this._maskExtent = t._getMaskPainter().get2DExtent();
            return e.intersects(this._extent2D),
            this.layer.fire("renderstart", {
                context: this.context,
                gl: this.gl
            }),
            e
        }
        ,
        e.clipCanvas = function(e) {
            var t = this.layer.getMask();
            if (!t)
                return !1;
            var i = this.middleWest
              , n = this.getMap();
            this.middleWest = n._containerPointToPoint(new dt(0,n.height / 2)),
            e.save();
            var r = n.getDevicePixelRatio();
            if (1 !== r && (e.save(),
            e.scale(r, r)),
            t.getGeometries) {
                e.isMultiClip = !0;
                var o = t.getGeometries() || [];
                e.beginPath(),
                o.forEach(function(t) {
                    t._getMaskPainter().paint(null, e)
                }),
                e.stroke(),
                e.isMultiClip = !1
            } else {
                e.isClip = !0,
                e.beginPath(),
                t._getMaskPainter().paint(null, e),
                e.isClip = !1
            }
            return 1 !== r && e.restore(),
            e.clip(),
            this.middleWest = i,
            !0
        }
        ,
        e.getViewExtent = function() {
            return {
                extent: this._extent2D,
                maskExtent: this._maskExtent,
                zoom: this._renderZoom,
                middleWest: this.middleWest
            }
        }
        ,
        e.completeRender = function() {
            this.getMap() && (this._renderComplete = !0,
            this.layer.fire("renderend", {
                context: this.context,
                gl: this.gl
            }),
            this.setCanvasUpdated())
        }
        ,
        e.getEvents = function() {
            return {
                _zoomstart: this.onZoomStart,
                _zooming: this.onZooming,
                _zoomend: this.onZoomEnd,
                _resize: this.onResize,
                _movestart: this.onMoveStart,
                _moving: this.onMoving,
                _moveend: this.onMoveEnd,
                _dragrotatestart: this.onDragRotateStart,
                _dragrotating: this.onDragRotating,
                _dragrotateend: this.onDragRotateEnd,
                _spatialreferencechange: this.onSpatialReferenceChange
            }
        }
        ,
        e.onZoomStart = function() {}
        ,
        e.onZoomEnd = function() {
            this.setToRedraw()
        }
        ,
        e.onZooming = function() {}
        ,
        e.onMoveStart = function() {}
        ,
        e.onMoving = function() {}
        ,
        e.onMoveEnd = function() {
            this.setToRedraw()
        }
        ,
        e.onResize = function() {
            delete this._extent2D,
            this.resizeCanvas(),
            this.setToRedraw()
        }
        ,
        e.onDragRotateStart = function() {}
        ,
        e.onDragRotating = function() {}
        ,
        e.onDragRotateEnd = function() {
            this.setToRedraw()
        }
        ,
        e.onSpatialReferenceChange = function() {}
        ,
        e.getDrawTime = function() {
            return this._drawTime
        }
        ,
        e._tryToDraw = function(t) {
            this._toRedraw = !1,
            !this.canvas && this.layer.isEmpty && this.layer.isEmpty() ? this._renderComplete = !0 : this._drawAndRecord(t)
        }
        ,
        e._drawAndRecord = function(t) {
            if (this.getMap()) {
                var e = this._painted;
                this._painted = !0;
                var i = x();
                this.draw(t),
                i = x() - i,
                this._drawTime = e ? i : i / 2,
                e && this.layer && this.layer.options.logDrawTime && console.log(this.layer.getId(), "frameTimeStamp:", t, "drawTime:", this._drawTime)
            }
        }
        ,
        e._promiseResource = function(n) {
            var r = this.layer
              , o = this
              , s = this.resources
              , a = r.options.crossOrigin
              , h = r.options.renderer || "";
            return function(i) {
                if (s.isResourceLoaded(n, !0))
                    i(n);
                else if (!ft(n[0]) && o._resWorkerConn && ("canvas" !== r.options.renderer || r.options.decodeImageInWorker)) {
                    var t = Zt(n[0]);
                    o._resWorkerConn.fetchImage(t, function(t, e) {
                        if (t)
                            return t && "undefined" != typeof console && console.warn(t),
                            void i(n);
                        Nt(e, function(t) {
                            o._cacheResource(n, t),
                            i(n)
                        })
                    })
                } else {
                    var e = new Image;
                    ut(a) ? "canvas" !== h && (e.crossOrigin = "") : e.crossOrigin = a,
                    ft(n[0]) && !f && (n[1] && (n[1] *= 2),
                    n[2] && (n[2] *= 2)),
                    e.onload = function() {
                        o._cacheResource(n, e),
                        i(n)
                    }
                    ,
                    e.onabort = function(t) {
                        console && console.warn("image loading aborted: " + n[0]),
                        t && console && console.warn(t),
                        i(n)
                    }
                    ,
                    e.onerror = function(t) {
                        t && "undefined" != typeof console && console.warn(t),
                        s.markErrorResource(n),
                        i(n)
                    }
                    ,
                    gt(e, n)
                }
            }
        }
        ,
        e._cacheResource = function(t, e) {
            if (this.layer && this.resources) {
                var i = t[1]
                  , n = t[2];
                if (this.layer.options.cacheSvgOnCanvas && 1 === ft(t[0]) && ($.edge || $.ie)) {
                    ut(i) && (i = e.width || this.layer.options.defaultIconSize[0]),
                    ut(n) && (n = e.height || this.layer.options.defaultIconSize[1]);
                    var r = Gn.createCanvas(i, n);
                    Gn.image(r.getContext("2d"), e, 0, 0, i, n),
                    e = r
                }
                this.resources.addResource(t, e)
            }
        }
        ,
        t
    }(qn)
      , zo = function() {
        function t() {
            this.resources = {},
            this._errors = {}
        }
        var e = t.prototype;
        return e.addResource = function(e, t) {
            var i = this;
            if (this.resources[e[0]] = {
                image: t,
                width: +e[1],
                height: +e[2],
                refCnt: 0
            },
            t && t.width && t.height && !t.close && $.imageBitMap && !$.safari && !$.iosWeixin) {
                if (t.src && ft(t.src))
                    return;
                createImageBitmap(t).then(function(t) {
                    i.resources[e[0]] && (i.resources[e[0]].image = t)
                })
            }
        }
        ,
        e.isResourceLoaded = function(t, e) {
            if (!t)
                return !1;
            var i = this._getImgUrl(t);
            if (this._errors[i])
                return !0;
            var n = this.resources[i];
            return !!n && !(e && ft(t[0]) && (+t[1] > n.width || +t[2] > n.height))
        }
        ,
        e.login = function(t) {
            var e = this.resources[t];
            e && e.refCnt++
        }
        ,
        e.logout = function(t) {
            var e = this.resources[t];
            e && e.refCnt-- <= 0 && (e.image && e.image.close && e.image.close(),
            delete this.resources[t])
        }
        ,
        e.getImage = function(t) {
            var e = this._getImgUrl(t);
            return !this.isResourceLoaded(t) || this._errors[e] ? null : this.resources[e].image
        }
        ,
        e.markErrorResource = function(t) {
            this._errors[this._getImgUrl(t)] = 1
        }
        ,
        e.merge = function(t) {
            if (!t)
                return this;
            for (var e in t.resources) {
                var i = t.resources[e];
                this.addResource([e, i.width, i.height], i.image)
            }
            return this
        }
        ,
        e.forEach = function(t) {
            if (!this.resources)
                return this;
            for (var e in this.resources)
                v(this.resources, e) && t(e, this.resources[e]);
            return this
        }
        ,
        e._getImgUrl = function(t) {
            return Array.isArray(t) ? t[0] : t
        }
        ,
        e.remove = function() {
            for (var t in this.resources) {
                var e = this.resources[t];
                e && e.image && e.image.close && e.image.close()
            }
            this.resources = {}
        }
        ,
        t
    }();
    $.decodeImageInWorker && Qi(Vi, function() {
        return "\nfunction (exports) {\n    exports.onmessage = function (msg, postResponse) {\n        var url = msg.data.url;\n        var fetchOptions = msg.data.fetchOptions;\n        requestImageOffscreen(url, function (err, data) {\n            var buffers = [];\n            if (data && data.data) {\n                buffers.push(data.data);\n            }\n            postResponse(err, data, buffers);\n        }, fetchOptions);\n    };\n\n    function requestImageOffscreen(url, cb, fetchOptions) {\n        fetch(url, fetchOptions ? fetchOptions : {})\n            .then(response => response.arrayBuffer())\n            .then(arrayBuffer => {\n                const blob=new Blob([arrayBuffer]);\n                return createImageBitmap(blob);\n            })\n            .then(bitmap => {\n                cb(null, {data:bitmap});\n            }).catch(err => {\n                console.warn('error when loading tile:', url);\n                console.warn(err);\n                cb(err);\n            });\n    }\n}"
    });
    var jo = {
        markerWidth: 10,
        markerHeight: 10,
        markerLineWidth: 1
    }
      , Fo = new dt(0,0);
    function Go(t, e, i, n, r, o) {
        var s = r.x + o.x
          , a = r.y + o.y;
        Fo.x = s,
        Fo.y = a;
        var h = function(t) {
            if (!t)
                return 0;
            var e = t.x
              , i = t.y;
            if (0 === e && 0 === i)
                return 0;
            if (0 === e || !e) {
                if (i < 0)
                    return -Math.PI / 2;
                if (0 < i)
                    return Math.PI / 2
            }
            var n = i / e;
            return i < 0 && e < 0 ? Math.atan(n) - Math.PI : 0 < i && e < 0 ? Math.atan(n) + Math.PI : Math.atan(n)
        }(Fo)
          , l = Math.sqrt(s * s + a * a)
          , u = 0
          , c = 0;
        u += Math.cos(e + h) * l,
        c += Math.sin(e + h) * l;
        var d, f, g, p, m, _, v, y, x, w, C, b, P, M, T, S, E, R = (d = i,
        f = n,
        g = e,
        p = Math.PI / 2 + g,
        m = Math.PI / 4 + g,
        _ = g,
        v = f,
        y = Math.sqrt(d * d + f * f),
        x = d,
        w = Math.cos(p) * v,
        C = Math.sin(p) * v,
        b = Math.cos(m) * y,
        P = Math.sin(m) * y,
        M = Math.cos(_) * x,
        T = Math.sin(_) * x,
        S = Math.min(w, b, M, 0),
        E = Math.min(C, P, T, 0),
        [S, E, Math.max(w, b, M, 0) - S, Math.max(C, P, T, 0) - E]), A = R[2], k = R[3];
        c += R[1];
        var O = (u += R[0]) + Math.max(i, A)
          , L = c + Math.max(n, k);
        return t.set(u, c, O, L),
        t
    }
    var Ho = new dt(0,0);
    function Bo(t, e, i, n, r, o, s) {
        var a = Ho.set(e, i);
        if (n)
            return Go(t, n, o, s, a, r);
        var h, l, u, c, d, f, g = t.set(a.x, a.y, a.x + o, a.y + s);
        return g._add(r),
        n && (l = n,
        u = (h = g).xmin,
        c = h.ymin,
        d = h.xmax,
        f = h.ymax,
        Xo.set(u, c, d, f),
        Xo.convertTo(function(t) {
            return t._rotate(l)
        }, h)),
        g
    }
    var No = [];
    function Zo(t, e, i) {
        if ((i = i || qo(No, e)) && (0 === i[0] || 0 === i[1]))
            return hs(t),
            t;
        var n = Jo(e, i[0], i[1]);
        return Bo(t, e.markerDx || 0, e.markerDy || 0, Yo(e), n, i[0], i[1])
    }
    function Wo(t) {
        return "rectangle" === t ? "right" : "middle"
    }
    function Vo(t) {
        return "bar" === t || "pie" === t || "pin" === t ? "top" : "rectangle" === t ? "bottom" : "middle"
    }
    var Uo = new Oe(0,0);
    function Jo(t, e, i) {
        var n = 2 * (t.shadowBlur || 0) + .5;
        Uo.width = e,
        Uo.height = i;
        var r = t.markerType
          , o = We(Uo, t.markerHorizontalAlignment || Wo(r), t.markerVerticalAlignment || Vo(r));
        return o.x !== -e / 2 && (o.x -= bt(o.x + e / 2) * n),
        o.y !== -i / 2 && (o.y -= bt(o.y + i / 2) * n),
        o
    }
    function qo(t, e) {
        var i = Ct(e.markerWidth, jo.markerWidth)
          , n = Ct(e.markerHeight, jo.markerHeight);
        if (0 === i || 0 === n)
            return t[0] = 0,
            t[1] = 0,
            t;
        var r = Ct(e.markerLineWidth, jo.markerLineWidth)
          , o = 2 * ((e.shadowBlur || 0) + Math.max(Math.abs(e.shadowOffsetX || 0) + Math.abs(e.shadowOffsetY || 0)))
          , s = Math.round(i + r + o + 1)
          , a = Math.round(n + r + o + 1);
        return t[0] = s,
        t[1] = a,
        t
    }
    var Xo = new Vr;
    function Yo(t, e) {
        void 0 === e && (e = "markerRotation");
        var i = t[e];
        return G(i) ? -i * Math.PI / 180 : 0
    }
    function Qo(t, e, i) {
        var n = e.markerFile
          , r = i ? i.getImage(n) : null
          , o = e.markerWidth || (r ? r.width : 0)
          , s = e.markerHeight || (r ? r.height : 0);
        if (Uo.width = o,
        Uo.height = s,
        0 === e.markerWidth || 0 === e.markerHeight)
            return hs(t),
            t;
        var a = We(Uo, e.markerHorizontalAlignment || "middle", e.markerVerticalAlignment || "top");
        return Bo(t, e.markerDx || 0, e.markerDy || 0, Yo(e), a, o, s)
    }
    function Ko(t, e, i) {
        var n = i.size;
        if (n && (0 === n.width || 0 === n.height))
            return hs(t),
            t;
        var r = We(n, e.textHorizontalAlignment, e.textVerticalAlignment)
          , o = e.textHaloRadius || 0
          , s = Bo(t, e.textDx || 0, e.textDy || 0, Yo(e, "textRotation"), r, n.width, n.height);
        return s.xmin -= o,
        s.xmax += o,
        s.ymin -= o,
        s.ymax += o,
        s
    }
    var $o = new Vr;
    function ts(t, e, i, n) {
        var r = t || new Vr;
        if (Array.isArray(e)) {
            for (var o = e, s = 0; s < o.length; s++)
                ts(r, o[s], i, n[s]);
            return r
        }
        return es(e) && r._combine(Ko($o, e, n)),
        is(e) && r._combine(Qo($o, e, i)),
        ns(e) && r._combine(Zo($o, e)),
        rs(e) && r._combine(Qo($o, e)),
        r
    }
    function es(t) {
        return !!t && !ut(t.textName)
    }
    function is(t) {
        return !!t && !ut(t.markerFile)
    }
    function ns(t) {
        return !!t && !(!ut(t.markerFile) || ut(t.markerType) || "path" === t.markerType)
    }
    function rs(t) {
        return !!t && !(!ut(t.markerFile) || "path" !== t.markerType)
    }
    var os, ss = ["markerWidth", "markerHeight", "markerHorizontalAlignment", "markerVerticalAlignment", "markerDx", "markerDy", "markerRotation", "textName", "textSize", "textDx", "textDy", "textVerticalAlignment", "textHorizontalAlignment", "textRotation", "textWrapWidth"], as = ["textName", "markerType", "markerFile", "textHaloRadius", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "textWrapWidth"];
    function hs(t) {
        t && (t.xmin = 1 / 0,
        t.ymin = 1 / 0,
        t.xmax = -1 / 0,
        t.ymax = -1 / 0)
    }
    function ls(t, e, i, n) {
        for (var r, o = [], s = 0, a = 0, h = t.length; a < h - 1; a++)
            (r = us(t[a], t[a + 1], e, a, i, n)) && (o[s] = o[s] || [],
            o[s].push({
                point: r[0],
                index: a
            }),
            r[1] === t[a + 1] && a !== h - 2 || (o[s].push({
                point: r[1],
                index: a + 1
            }),
            s++));
        return o
    }
    function us(t, e, i, n, r, o) {
        var s, a, h, l = n ? os : fs(t, i), u = fs(e, i);
        for (os = u; ; ) {
            if (!(l | u))
                return [t, e];
            if (l & u)
                return !1;
            if (o)
                return [t, e];
            h = fs(a = ds(t, e, s = l || u, i, r), i),
            s === l ? (t = a,
            l = h) : (e = a,
            u = h)
        }
    }
    function cs(t, e, i) {
        var n, r, o, s, a, h, l, u, c, d = [1, 4, 2, 8];
        for (r = 0,
        l = t.length; r < l; r++)
            t[r]._code = fs(t[r], e);
        for (s = 0; s < 4; s++) {
            for (u = d[s],
            n = [],
            r = 0,
            o = (l = t.length) - 1; r < l; o = r++)
                a = t[r],
                h = t[o],
                a._code & u ? h._code & u || ((c = ds(h, a, u, e, i))._code = fs(c, e),
                n.push(c)) : (h._code & u && ((c = ds(h, a, u, e, i))._code = fs(c, e),
                n.push(c)),
                n.push(a));
            t = n
        }
        return t
    }
    function ds(t, e, i, n, r) {
        var o, s, a = e.x - t.x, h = e.y - t.y, l = n.getMin(), u = n.getMax();
        8 & i ? (o = t.x + a * (u.y - t.y) / h,
        s = u.y) : 4 & i ? (o = t.x + a * (l.y - t.y) / h,
        s = l.y) : 2 & i ? (o = u.x,
        s = t.y + h * (u.x - t.x) / a) : 1 & i && (o = l.x,
        s = t.y + h * (l.x - t.x) / a);
        var c = new dt(o,s);
        return r && c._round(),
        c
    }
    function fs(t, e) {
        var i = 0;
        return t.x < e.getMin().x ? i |= 1 : t.x > e.getMax().x && (i |= 2),
        t.y < e.getMin().y ? i |= 4 : t.y > e.getMax().y && (i |= 8),
        i
    }
    function gs(t, e, i, n) {
        t = new dt(t);
        var r, o, s, a = Math.abs(i.x - e.x), h = Math.abs(i.y - e.y), l = Math.sqrt(Math.abs(a * a - h * h));
        return h <= a ? (r = new dt(e.x - l,e.y),
        o = new dt(e.x + l,e.y),
        s = 2 * a) : (r = new dt(e.x,e.y - l),
        o = new dt(e.x,e.y + l),
        s = 2 * h),
        t.distanceTo(r) + t.distanceTo(o) <= s + 2 * n
    }
    var ps = function() {
        function t() {
            this.bbox = Rn()
        }
        var e = t.prototype;
        return e._setBBOX = function(t, e, i, n, r) {
            return t.isHitTesting || Ln(this.bbox, e, i, n, r),
            this
        }
        ,
        e._bufferBBOX = function(t, e) {
            return void 0 === e && (e = 0),
            t.isHitTesting || In(this.bbox, e),
            this
        }
        ,
        e.getMap = function() {
            return this.geometry.getMap()
        }
        ,
        e.getPainter = function() {
            return this.painter
        }
        ,
        e.isDynamicSize = function() {
            return !1
        }
        ,
        t.testColor = function(t) {
            return !(!t || !P(t)) && 0 <= i.indexOf(t)
        }
        ,
        t
    }()
      , ms = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i._prepareContext = function(t) {
            if (ne(this.symbol.opacity) ? this._opacityFn || (this._opacityFn = oe(this.symbol.opacity)) : delete this._opacityFn,
            G(this.symbol.opacity))
                t.globalAlpha !== this.symbol.opacity && (t.globalAlpha = this.symbol.opacity);
            else if (this._opacityFn) {
                var e = this.getMap();
                t.globalAlpha = this._opacityFn(e.getZoom())
            } else
                1 !== t.globalAlpha && (t.globalAlpha = 1)
        }
        ,
        i.prepareCanvas = function(t, e, i) {
            t.setLineDash && St(e.lineDasharray) && t.setLineDash(e.lineDasharray);
            var n = this.getPainter().isHitTesting();
            Gn.prepareCanvas(t, e, i, n)
        }
        ,
        i.remove = function() {}
        ,
        i.setZIndex = function() {}
        ,
        i.show = function() {}
        ,
        i.hide = function() {}
        ,
        i._defineStyle = function(t) {
            return Me(t, this.geometry)
        }
        ,
        e
    }(ps);
    function _s(t, e, i, n) {
        var r, o, s, a, h, l = vs(i), u = i, c = u.markerType.toLowerCase(), d = ys(c, u.markerWidth, u.markerHeight), f = l.lineOpacity, g = l.polygonOpacity;
        Qe(l.polygonFill) && (Qe(l.polygonFill) && (r || (o = e,
        s = u.markerWidth,
        a = u.markerHeight,
        (h = new Vr)._combine(o),
        h.xmin += -s / 2,
        h.ymin += -a / 2,
        h.xmax += s / 2,
        h.ymax += a / 2,
        r = h),
        l.polygonGradientExtent = r));
        Gn.prepareCanvas(t, l, n);
        var p = u.markerWidth
          , m = u.markerHeight
          , _ = u.markerLineWidth / 2;
        if ("ellipse" === c)
            Gn.ellipse(t, e, p / 2, m / 2, m / 2, f, g);
        else if ("cross" === c || "x" === c) {
            for (var v = d.length - 1; 0 <= v; v--)
                d[v]._add(e);
            Gn.path(t, d.slice(0, 2), f),
            Gn.path(t, d.slice(2, 4), f)
        } else if ("diamond" === c || "bar" === c || "square" === c || "rectangle" === c || "triangle" === c) {
            "bar" === c ? e = e.add(0, -_) : "rectangle" === c && (e = e.add(_, _));
            for (var y = d.length - 1; 0 <= y; y--)
                d[y]._add(e);
            Gn.polygon(t, d, f, g)
        } else if ("pin" === c) {
            e = e.add(0, -_);
            for (var x = d.length - 1; 0 <= x; x--)
                d[x]._add(e);
            var w = t.lineCap;
            t.lineCap = "round",
            Gn.bezierCurveAndFill(t, d, f, g),
            t.lineCap = w
        } else {
            if ("pie" !== c)
                throw new Error("unsupported markerType: " + c);
            e = e.add(0, -_);
            var C = 180 * Math.atan(p / 2 / m) / Math.PI
              , b = t.lineCap;
            t.lineCap = "round",
            Gn.sector(t, e, m, [90 - C, 90 + C], f, g),
            t.lineCap = b
        }
        return t.canvas
    }
    function vs(t) {
        var e = {
            lineColor: t.markerLineColor,
            linePatternFile: t.markerLinePatternFile,
            lineWidth: t.markerLineWidth,
            lineOpacity: t.markerLineOpacity,
            lineDasharray: t.markerLineDasharray,
            lineCap: "butt",
            lineJoin: "round",
            polygonFill: t.markerFill,
            polygonPatternFile: t.markerFillPatternFile,
            polygonOpacity: t.markerFillOpacity
        };
        return 0 === e.lineWidth && (e.lineOpacity = 0),
        e
    }
    function ys(t, e, i) {
        var n, r, o, s, a = i / 2, h = e / 2;
        if ("triangle" === t)
            return [n = new dt(0,0 - a), r = new dt(0 - h,0 + a), o = new dt(0 + h,0 + a)];
        if ("cross" === t)
            return [n = new dt(0 - h,0), r = new dt(0 + h,0), o = new dt(0,0 - a), s = new dt(0,0 + a)];
        if ("diamond" === t)
            return [n = new dt(0 - h,0), r = new dt(0,0 - a), o = new dt(0 + h,0), s = new dt(0,0 + a)];
        if ("square" === t)
            return [n = new dt(0 - h,0 + a), r = new dt(0 + h,0 + a), o = new dt(0 + h,0 - a), s = new dt(0 - h,0 - a)];
        if ("rectangle" === t)
            return r = (n = new dt(0,0)).add(e, 0),
            o = n.add(e, i),
            s = n.add(0, i),
            [n, r, o, s];
        if ("x" === t)
            return [n = new dt(0 - h,0 + a), r = new dt(0 + h,0 - a), o = new dt(0 + h,0 + a), s = new dt(0 - h,0 - a)];
        if ("bar" === t)
            return [n = new dt(0 - h,0 - i), r = new dt(0 + h,0 - i), o = new dt(0 + h,0), s = new dt(0 - h,0)];
        if ("pin" === t || "pie" === t) {
            var l = i * Math.atan(h / a);
            return [n = new dt(0,0), r = new dt(0 - l,0 - i), o = new dt(0 + l,0 - i), s = new dt(0,0)]
        }
        return []
    }
    var xs = new dt(0,0)
      , ws = new dt(0,0)
      , Cs = new dt(0,0)
      , bs = new dt(0,0)
      , Ps = function(r) {
        function t(t, e, i) {
            var n;
            return (n = r.call(this) || this).symbol = t,
            n.geometry = e,
            n.painter = i,
            n
        }
        it(t, r);
        var e = t.prototype;
        return e.get2DExtent = function() {
            for (var t = this.getMap(), e = t.getGLRes(), i = new Vr, n = this._getRenderPoints()[0], r = n.length - 1; 0 <= r; r--)
                n[r] && i._combine(t._pointAtResToPoint(n[r], e));
            return i
        }
        ,
        e.isDynamicSize = function() {
            var t = this.symbol;
            return ne(t.markerWidth) || ne(t.markerHeight) || ne(t.textSize)
        }
        ,
        e._rotateExtent = function(t, e) {
            return t.convertTo(function(t) {
                return t._rotate(e)
            })
        }
        ,
        e._getRenderPoints = function() {
            var t = this.getPainter().isSpriting() ? "center" : this.getPlacement();
            return this.getPainter().getRenderPoints(t)
        }
        ,
        e._getRenderContainerPoints = function(t) {
            var e = this.getPainter();
            if (e.isSpriting())
                return this._getRenderPoints()[0];
            var i, n = this.geometry, r = this.getDxDy();
            if (n._cPoint && !t) {
                var o = t ? Cs : bs;
                o.set(n._cPoint.x, n._cPoint.y);
                var s = e.containerOffset;
                o._sub(s);
                var a = r.x
                  , h = r.y;
                (a || h) && o._add(a || 0, h || 0),
                i = [o]
            } else {
                var l = this._getRenderPoints()[0];
                i = this.painter._pointContainerPoints(l, r.x, r.y, t, !0, this.getPlacement())
            }
            if (!i || !Array.isArray(i[0]))
                return i;
            for (var u = [], c = 0, d = i.length; c < d; c++)
                for (var f = 0, g = i[c].length; f < g; f++)
                    u.push(i[c][f]);
            return u
        }
        ,
        e.getPlacement = function() {
            return this.symbol.markerPlacement
        }
        ,
        e.getRotation = function() {
            return Yo(this.style)
        }
        ,
        e.getDxDy = function() {
            var t = this.style
              , e = t.markerDx
              , i = t.markerDy;
            return new dt(e,i)
        }
        ,
        e._getRotationAt = function(t) {
            var e = this.getRotation();
            e || (e = 0);
            var i = this._getRenderPoints()[1];
            if (!i || !i[t])
                return e;
            var n = this.getMap()
              , r = i[t][0]
              , o = i[t][1];
            if (n.isTransforming()) {
                var s = n.getGLRes();
                return r = n._pointAtResToContainerPoint(i[t][0], s, 0, xs),
                o = n._pointAtResToContainerPoint(i[t][1], s, 0, ws),
                e + zt(r.x, r.y, o.x, o.y)
            }
            return e + -zt(r.x, r.y, o.x, o.y)
        }
        ,
        e._rotate = function(t, e, i) {
            if (i) {
                var n = this.getDxDy()
                  , r = e.sub(n);
                return t.save(),
                t.translate(r.x, r.y),
                t.rotate(i),
                n
            }
            return null
        }
        ,
        t
    }(ms)
      , Ms = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.getPlacement = function() {
            return "point"
        }
        ,
        i.getDxDy = function() {
            return new dt(0,0)
        }
        ,
        i.symbolize = function(t) {
            var e = this.geometry
              , i = e.getLayer();
            if (e.options.debug || !i || i.options.debug) {
                var n = this.getMap();
                if (n && !n.isZooming()) {
                    var r = i.options.debugOutline;
                    t.strokeStyle = r,
                    t.fillStyle = r,
                    t.lineWidth = 1,
                    t.font = "18px  serif";
                    var o = e.getContainerExtent().toArray();
                    Gn.polygon(t, [o], 1, 0);
                    for (var s = this._getRenderContainerPoints(), a = this.geometry.getId(), h = ys("cross", 10, 10), l = 0; l < s.length; l++) {
                        var u = s[l];
                        ut(a) || Gn.fillText(t, a, u.add(8, -4), r);
                        for (var c = [], d = 0; d < h.length; d++)
                            c.push(h[d].add(u));
                        Gn.path(t, c.slice(0, 2), 1),
                        Gn.path(t, c.slice(2, 4), 1)
                    }
                }
            }
        }
        ,
        e
    }(Ps)
      , Ts = new Oe(1,1)
      , Ss = new Vr
      , Es = function(r) {
        function t(t, e, i) {
            var n;
            return (n = r.call(this, t, e, i) || this).style = n._defineStyle(n.translate()),
            n
        }
        it(t, r),
        t.test = function(t) {
            return is(t)
        }
        ;
        var e = t.prototype;
        return e.symbolize = function(t, e) {
            var i = this.style;
            if (this.painter.isHitTesting() || 0 !== i.markerWidth && 0 !== i.markerHeight && 0 !== i.markerOpacity) {
                var n = this._getRenderContainerPoints();
                if (St(n)) {
                    var r = this._getImage(e);
                    if (r) {
                        this._prepareContext(t);
                        var o, s = i.markerWidth, a = i.markerHeight;
                        if (!G(s) || !G(a)) {
                            s = r.width,
                            a = r.height,
                            i.markerWidth = s,
                            i.markerHeight = a;
                            var h = i.markerFile;
                            e.isResourceLoaded(h) || e.addResource(h, r);
                            var l = this.getPainter();
                            l.isSpriting() || l.removeCache()
                        }
                        "path" !== this.symbol.markerType && G(i.markerOpacity) && i.markerOpacity < 1 && (o = t.globalAlpha,
                        t.globalAlpha *= i.markerOpacity),
                        Ts.width = s,
                        Ts.height = a;
                        for (var u = We(Ts, i.markerHorizontalAlignment, i.markerVerticalAlignment), c = 0, d = n.length; c < d; c++) {
                            var f = n[c]
                              , g = this.getRotation() ? this._rotate(t, f, this._getRotationAt(c)) : null
                              , p = void 0;
                            if (g) {
                                var m = f.sub(g);
                                f = g;
                                var _ = this._getRotationAt(c);
                                (p = Go(Ss, _, s, a, f, u))._add(m)
                            }
                            var v = f.x + u.x
                              , y = f.y + u.y;
                            Gn.image(t, r, v, y, s, a),
                            g && t.restore(),
                            g ? this._setBBOX(t, p.xmin, p.ymin, p.xmax, p.ymax) : this._setBBOX(t, v, y, v + s, y + a)
                        }
                        void 0 !== o && (t.globalAlpha = o)
                    } else
                        "undefined" != typeof console && console.warn("no img found for " + (this.style.markerFile || this._url[0]))
                }
            }
        }
        ,
        e._getImage = function(t) {
            return e = t,
            i = this.style.markerFile,
            e && e.getImage(i) || null;
            var e, i
        }
        ,
        e.getFixedExtent = function(t) {
            return this._fixedExtent = this._fixedExtent || new Vr,
            Qo(this._fixedExtent, this.style, t)
        }
        ,
        e.translate = function() {
            var t = this.symbol;
            return {
                markerFile: t.markerFile,
                markerOpacity: Ct(t.markerOpacity, 1),
                markerWidth: Ct(t.markerWidth, null),
                markerHeight: Ct(t.markerHeight, null),
                markerRotation: Ct(t.markerRotation, 0),
                markerDx: Ct(t.markerDx, 0),
                markerDy: Ct(t.markerDy, 0),
                markerHorizontalAlignment: Ct(t.markerHorizontalAlignment, "middle"),
                markerVerticalAlignment: Ct(t.markerVerticalAlignment, "top")
            }
        }
        ,
        t
    }(Ps)
      , Rs = new Rr(0,0)
      , As = new Rr(0,0)
      , ks = function(r) {
        function t(t, e, i) {
            var n;
            return (n = r.call(this) || this).symbol = t,
            n.geometry = e,
            n.painter = i,
            e.isPoint ? at(n) : (n.style = n._defineStyle(n.translate()),
            n)
        }
        it(t, r),
        t.test = function(t, e) {
            if (!t)
                return !1;
            if (e && e.isPoint)
                return !1;
            for (var i in t) {
                var n = i.slice(0, 4);
                if ("line" === n || "poly" === n)
                    return !0
            }
            return !1
        }
        ;
        var e = t.prototype;
        return e.symbolize = function(t, e) {
            var i = this.style;
            if (0 !== i.polygonOpacity || 0 !== i.lineOpacity || this.painter.isHitTesting()) {
                var n = this._getPaintParams();
                if (n) {
                    this._prepareContext(t);
                    var r = Qe(i.lineColor)
                      , o = "Polygon" === this.geometry.getJSONType() || "LineString" === this.geometry.type;
                    !r || !i.lineColor.places && o || (i.lineGradientExtent = this.geometry.getContainerExtent()._expand(i.lineWidth)),
                    Qe(i.polygonFill) && (i.polygonGradientExtent = this.geometry.getContainerExtent());
                    var s = this.geometry.getLayer().options.geometryEventTolerance || 0
                      , a = this.geometry._hitTestTolerance() + s
                      , h = n[0];
                    if ("Polygon" === this.geometry.getJSONType() && 0 < h.length && Array.isArray(h[0][0]) || "LineString" === this.geometry.type && 0 < h.length && Array.isArray(h[0]))
                        for (var l = 0; l < h.length; l++) {
                            this.prepareCanvas(t, i, e),
                            r && o && !i.lineColor.places && this._createGradient(t, h[l], i.lineColor);
                            var u = [t, h[l]];
                            1 < n.length && u.push.apply(u, n.slice(1)),
                            u.push(i.lineOpacity, i.polygonOpacity, i.lineDasharray);
                            var c = this.geometry._paintOn.apply(this.geometry, u);
                            this._setBBOX(t, c),
                            this._bufferBBOX(t, a)
                        }
                    else {
                        this.prepareCanvas(t, i, e),
                        r && o && !i.lineColor.places && this._createGradient(t, h, i.lineColor);
                        var d = [t];
                        d.push.apply(d, n),
                        d.push(i.lineOpacity, i.polygonOpacity, i.lineDasharray);
                        var f = this.geometry._paintOn.apply(this.geometry, d);
                        this._setBBOX(t, f),
                        this._bufferBBOX(t, a)
                    }
                    t.setLineDash && Array.isArray(i.lineDasharray) && t.setLineDash([])
                }
            }
        }
        ,
        e.get2DExtent = function() {
            var t = this.getMap()
              , e = this.geometry._getPrjExtent();
            if (!e)
                return null;
            this._extMin && this._extMax || (this._extMin = new Rr(0,0),
            this._extMax = new Rr(0,0)),
            this._extMin.x = e.xmin,
            this._extMin.y = e.ymin,
            this._extMax.x = e.xmax,
            this._extMax.y = e.ymax;
            var i = t._prjToPoint(this._extMin, void 0, Rs)
              , n = t._prjToPoint(this._extMax, void 0, As);
            return this._pxExtent ? this._pxExtent.set(Math.min(i.x, n.x), Math.min(i.y, n.y), Math.max(i.x, n.x), Math.max(i.y, n.y)) : this._pxExtent = new Vr(i,n),
            this._pxExtent
        }
        ,
        e.getFixedExtent = function() {
            var t = this.style.lineWidth / 2;
            return new Vr(-t,-t,t,t)
        }
        ,
        e._getPaintParams = function() {
            return this.getPainter().getPaintParams(this.style.lineDx, this.style.lineDy)
        }
        ,
        e.translate = function() {
            var t = this.symbol
              , e = {
                lineColor: Ct(t.lineColor, "#000"),
                lineWidth: Ct(t.lineWidth, 2),
                lineOpacity: Ct(t.lineOpacity, 1),
                lineDasharray: Ct(t.lineDasharray, []),
                lineCap: Ct(t.lineCap, "butt"),
                lineJoin: Ct(t.lineJoin, "miter"),
                linePatternFile: Ct(t.linePatternFile, null),
                lineDx: Ct(t.lineDx, 0),
                lineDy: Ct(t.lineDy, 0),
                polygonFill: Ct(t.polygonFill, null),
                polygonOpacity: Ct(t.polygonOpacity, 1),
                polygonPatternFile: Ct(t.polygonPatternFile, null),
                polygonPatternDx: Ct(t.polygonPatternDx, 0),
                polygonPatternDy: Ct(t.polygonPatternDy, 0),
                linePatternDx: Ct(t.linePatternDx, 0),
                linePatternDy: Ct(t.linePatternDy, 0)
            };
            return 0 === e.lineWidth && (e.lineOpacity = 0),
            "LineString" !== this.geometry.type || e.polygonFill || (e.polygonFill = e.lineColor),
            e
        }
        ,
        e._createGradient = function(t, e, i) {
            if (Array.isArray(e) && e.length) {
                var n = function(t) {
                    var e, i = !0;
                    Array.isArray(t[0]) ? (e = t[0],
                    i = !1) : e = t;
                    var n = e.length;
                    if (i)
                        return [e[0], e[n - 1]];
                    for (var r, o = e[0], s = 0, a = 1; a < n; a++) {
                        var h = e[a]
                          , l = o.distanceTo(h);
                        s < l && (s = l,
                        r = h)
                    }
                    return [o, r]
                }(e)
                  , r = n[0]
                  , o = n[1];
                if (r && o) {
                    var s = t.createLinearGradient(r.x, r.y, o.x, o.y);
                    i.colorStops.forEach(function(t) {
                        s.addColorStop.apply(s, t)
                    }),
                    t.strokeStyle = s
                } else
                    console.error("unable create canvas LinearGradient,error data:", e)
            }
        }
        ,
        t
    }(ms);
    var Os, Ls = new Vr, Ds = function(o) {
        function t(t, e, i) {
            var n, r = (n = o.call(this, t, e, i) || this).translate();
            return n._dynamic = re(r),
            n.style = n._defineStyle(r),
            0 === n.style.textWrapWidth ? at(n) : (n.strokeAndFill = n._defineStyle(n.translateLineAndFill(n.style)),
            n)
        }
        it(t, o),
        t.test = function(t) {
            return es(t)
        }
        ;
        var e = t.prototype;
        return e.symbolize = function(t, e) {
            if (this.painter.isHitTesting() || 0 !== this.style.textSize && (this.style.textOpacity || this.style.textHaloRadius && this.style.textHaloOpacity) && 0 !== this.style.textWrapWidth) {
                var i = this._getRenderContainerPoints();
                if (St(i)) {
                    var n = this.style
                      , r = this.strokeAndFill
                      , o = Ne(this.style.textName, this.geometry.getProperties());
                    this._dynamic && delete this._textDesc;
                    var s = this._textDesc = this._textDesc || Ze(o, this.style);
                    this._prepareContext(t),
                    this.prepareCanvas(t, r, e),
                    Gn.prepareCanvasFont(t, n);
                    for (var a = n.textHaloRadius || 0, h = 0, l = i.length; h < l; h++) {
                        var u = i[h]
                          , c = this.getRotation() ? this._rotate(t, u, this._getRotationAt(h)) : null
                          , d = void 0;
                        if (c) {
                            var f = u.sub(c);
                            u = c;
                            var g = this._getRotationAt(h)
                              , p = s.size || {
                                width: 0,
                                height: 0
                            }
                              , m = p.width
                              , _ = p.height
                              , v = We(s.size, n.textHorizontalAlignment, n.textVerticalAlignment);
                            (d = Go(Ls, g, m, _, u, v))._add(f)
                        }
                        var y = Gn.text(t, o, u, n, s);
                        c ? (this._setBBOX(t, d.xmin, d.ymin, d.xmax, d.ymax),
                        t.restore()) : this._setBBOX(t, y),
                        this._bufferBBOX(t, a)
                    }
                }
            }
        }
        ,
        e.getPlacement = function() {
            return this.symbol.textPlacement
        }
        ,
        e.getRotation = function() {
            var t = this.style.textRotation;
            return G(t) ? -t * Math.PI / 180 : null
        }
        ,
        e.getDxDy = function() {
            var t = this.style;
            return new dt(t.textDx,t.textDy)
        }
        ,
        e.getFixedExtent = function() {
            var t = this.geometry.getTextDesc();
            return Array.isArray(t) && (t = t[this._index]),
            this._fixedExtent = this._fixedExtent || new Vr,
            t ? Ko(this._fixedExtent, this.style, t) : this._fixedExtent
        }
        ,
        e.translate = function() {
            var t = this.symbol
              , e = {
                textName: t.textName,
                textFaceName: Ct(t.textFaceName, "monospace"),
                textWeight: Ct(t.textWeight, "normal"),
                textStyle: Ct(t.textStyle, "normal"),
                textSize: Ct(t.textSize, s),
                textFont: Ct(t.textFont, null),
                textFill: Ct(t.textFill, "#000"),
                textOpacity: Ct(t.textOpacity, 1),
                textHaloFill: Ct(t.textHaloFill, "#ffffff"),
                textHaloRadius: Ct(t.textHaloRadius, 0),
                textHaloOpacity: Ct(t.textHaloOpacity, 1),
                textWrapWidth: Ct(t.textWrapWidth, null),
                textWrapCharacter: Ct(t.textWrapCharacter, "\n"),
                textLineSpacing: Ct(t.textLineSpacing, 0),
                textDx: Ct(t.textDx, 0),
                textDy: Ct(t.textDy, 0),
                textHorizontalAlignment: Ct(t.textHorizontalAlignment, "middle"),
                textVerticalAlignment: Ct(t.textVerticalAlignment, "middle"),
                textAlign: Ct(t.textAlign, "center"),
                textRotation: Ct(t.textRotation, 0),
                textMaxWidth: Ct(t.textMaxWidth, 0),
                textMaxHeight: Ct(t.textMaxHeight, 0)
            };
            return 0 < e.textMaxWidth && (!e.textWrapWidth || e.textWrapWidth > e.textMaxWidth) && (e.textWrapWidth || (e.textMaxHeight = 1),
            e.textWrapWidth = e.textMaxWidth),
            e
        }
        ,
        e.translateLineAndFill = function(t) {
            return {
                lineColor: t.textHaloRadius ? t.textHaloFill : t.textFill,
                lineWidth: t.textHaloRadius,
                lineOpacity: t.textOpacity,
                lineDasharray: null,
                lineCap: "butt",
                lineJoin: "round",
                polygonFill: t.textFill,
                polygonOpacity: t.textOpacity
            }
        }
        ,
        t
    }(Ps), Is = [], zs = new Vr, js = new dt(0,0), Fs = function(o) {
        function t(t, e, i) {
            var n, r = (n = o.call(this, t, e, i) || this).translate();
            return n._dynamic = re(r),
            n.style = n._defineStyle(r),
            n.strokeAndFill = n._defineStyle(vs(n.style)),
            n.padding = 0,
            n
        }
        it(t, o),
        t.test = function(t) {
            return ns(t)
        }
        ;
        var e = t.prototype;
        return e.symbolize = function(t, e) {
            var i = this.style;
            if (this.painter.isHitTesting() || 0 !== i.markerWidth && 0 !== i.markerHeight && (0 !== i.polygonOpacity || 0 !== i.lineOpacity)) {
                var n = this._getRenderContainerPoints();
                St(n) && (this._prepareContext(t),
                this.getPainter().isSpriting() || this.geometry.getLayer().getMask() === this.geometry || this._dynamic || !1 === this.geometry.getLayer().options.cacheVectorOnCanvas ? this._drawMarkers(t, n, e) : this._drawMarkersWithCache(t, n, e))
            }
        }
        ,
        e._drawMarkers = function(t, e, i) {
            for (var n = e.length - 1; 0 <= n; n--) {
                var r = e[n]
                  , o = qo(Is, this.style)
                  , s = o[0]
                  , a = o[1]
                  , h = void 0
                  , l = this.getRotation() ? this._rotate(t, r, this._getRotationAt(n)) : null;
                if (l) {
                    var u = r.sub(l);
                    r = l;
                    var c = this._getRotationAt(n);
                    (h = Go(zs, c, s, a, r, js))._add(u)
                }
                if (this._drawVectorMarker(t, r, i),
                l)
                    t.restore(),
                    this._setBBOX(t, h.xmin, h.ymin, h.xmax, h.ymax);
                else {
                    var d = r
                      , f = d.x
                      , g = d.y;
                    this._setBBOX(t, f, g, f + s, g + a)
                }
            }
        }
        ,
        e._drawMarkersWithCache = function(t, e, i) {
            var n = this._stampSymbol()
              , r = i.getImage(n);
            r || (r = this._createMarkerImage(t, i),
            i.addResource([n, r.width, r.height], r));
            for (var o = Jo(this.style, r.width, r.height), s = e.length - 1; 0 <= s; s--) {
                var a = e[s]
                  , h = this.getRotation() ? this._rotate(t, a, this._getRotationAt(s)) : null
                  , l = void 0;
                if (h) {
                    var u = a.sub(h);
                    a = h;
                    var c = this._getRotationAt(s);
                    (l = Go(zs, c, r.width, r.height, a, o))._add(u)
                }
                var d = a.x + o.x
                  , f = a.y + o.y;
                Gn.image(t, r, d, f),
                h ? (t.restore(),
                this._setBBOX(t, l.xmin, l.ymin, l.xmax, l.ymax)) : this._setBBOX(t, d, f, d + r.width, f + r.height)
            }
        }
        ,
        e._createMarkerImage = function(t, e) {
            var i = t.canvas.constructor
              , n = qo(Is, this.style)
              , r = Gn.createCanvas(n[0], n[1], i)
              , o = this._getCacheImageAnchor(n[0], n[1])
              , s = r.getContext("2d");
            return this._drawVectorMarker(s, o, e),
            r
        }
        ,
        e._stampSymbol = function() {
            return this._stamp || (this._stamp = Xe([this.style.markerType, Qe(this.style.markerFill) ? Ke(this.style.markerFill) : this.style.markerFill, this.style.markerFillOpacity, this.style.markerFillPatternFile, Qe(this.style.markerLineColor) ? Ke(this.style.markerLineColor) : this.style.markerLineColor, this.style.markerLineWidth, this.style.markerLineOpacity, this.style.markerLineDasharray ? this.style.markerLineDasharray.join(",") : "", this.style.markerLinePatternFile, this.style.markerWidth, this.style.markerHeight, this.style.markerHorizontalAlignment, this.style.markerVerticalAlignment].join("_"))),
            this._stamp
        }
        ,
        e._getCacheImageAnchor = function(t, e) {
            var i = 2 * (this.symbol.shadowBlur || 0) + this.padding
              , n = this.style.markerType;
            return "bar" === n || "pie" === n || "pin" === n ? new dt(t / 2,e - i) : "rectangle" === n ? new dt(i,i) : new dt(t / 2,e / 2)
        }
        ,
        e._getGraidentExtent = function(t) {
            var e = new Vr
              , i = this.getDxDy()
              , n = this.getFixedExtent();
            if (Array.isArray(t))
                for (var r = t.length - 1; 0 <= r; r--)
                    e._combine(t[r]);
            else
                e._combine(t);
            return e.xmin += n.xmin - i.x,
            e.ymin += n.ymin - i.y,
            e.xmax += n.xmax - i.x,
            e.ymax += n.ymax - i.y,
            e
        }
        ,
        e._drawVectorMarker = function(t, e, i) {
            _s(t, e, this.style, i)
        }
        ,
        e.getFixedExtent = function() {
            var t = this.isDynamicSize()
              , e = this.style.markerWidth
              , i = this.style.markerHeight;
            return this._fixedExtent = this._fixedExtent || new Vr,
            Zo(this._fixedExtent, this.style, t ? [128, 128 * (0 === e ? 1 : i / e)] : null)
        }
        ,
        e.translate = function() {
            var t = this.symbol
              , e = {
                markerType: Ct(t.markerType, "ellipse"),
                markerFill: Ct(t.markerFill, "#00f"),
                markerFillOpacity: Ct(t.markerFillOpacity, 1),
                markerFillPatternFile: Ct(t.markerFillPatternFile, null),
                markerLineColor: Ct(t.markerLineColor, "#000"),
                markerLineWidth: Ct(t.markerLineWidth, jo.markerLineWidth),
                markerLineOpacity: Ct(t.markerLineOpacity, 1),
                markerLineDasharray: Ct(t.markerLineDasharray, []),
                markerLinePatternFile: Ct(t.markerLinePatternFile, null),
                markerDx: Ct(t.markerDx, 0),
                markerDy: Ct(t.markerDy, 0),
                markerWidth: Ct(t.markerWidth, jo.markerWidth),
                markerHeight: Ct(t.markerHeight, jo.markerHeight),
                markerRotation: Ct(t.markerRotation, 0),
                shadowBlur: Ct(t.shadowBlur, 0),
                shadowOffsetX: Ct(t.shadowOffsetX, 0),
                shadowOffsetY: Ct(t.shadowOffsetY, 0)
            }
              , i = e.markerType
              , n = Wo(i)
              , r = Vo(i);
            return e.markerHorizontalAlignment = Ct(t.markerHorizontalAlignment, n),
            e.markerVerticalAlignment = Ct(t.markerVerticalAlignment, r),
            G(t.markerOpacity) && (G(t.markerFillOpacity) && (e.markerFillOpacity *= t.markerOpacity),
            G(t.markerLineOpacity) && (e.markerLineOpacity *= t.markerOpacity)),
            e
        }
        ,
        t
    }(Ps), Gs = function(o) {
        function t(t, e, i) {
            var n;
            ut(t.markerWidth) && (t.markerWidth = 80),
            ut(t.markerHeight) && (t.markerHeight = 80),
            t = F(t, (n = o.call(this, t, e, i) || this).translate());
            var r = n.style = n._defineStyle(t);
            return $.gecko ? n._url = [Ee(r, r.markerWidth, r.markerHeight), r.markerWidth, r.markerHeight] : n._url = [Ee(r), r.markerWidth, r.markerHeight],
            n
        }
        it(t, o),
        t.test = function(t) {
            return rs(t)
        }
        ;
        var e = t.prototype;
        return e._prepareContext = function() {}
        ,
        e._getImage = function(e) {
            var i = this;
            if (e && e.isResourceLoaded(this._url))
                return e.getImage(this._url);
            var n = this.painter
              , t = new Image;
            return t.onload = function() {
                var t = n.getLayer() && n.getLayer().getRenderer();
                t && t.setToRedraw()
            }
            ,
            t.onerror = function(t) {
                t && "undefined" != typeof console && console.warn(t),
                e.markErrorResource(i._url)
            }
            ,
            t.src = this._url[0],
            e && e.addResource(this._url, t),
            t
        }
        ,
        t
    }(Es), Hs = {
        lineWidth: 1,
        polygonFill: "#fff",
        polygonOpacity: .5
    }, Bs = function(r) {
        function t(t, e, i) {
            var n;
            return (n = r.call(this, t, e, i) || this).style = e.getLayer().options.drawAltitude,
            n.style && _(n.style) || (n.style = {
                lineWidth: 2
            }),
            n.style.lineWidth || (n.style.lineWidth = 0),
            n.dxdy = n._defineStyle({
                dx: t.textDx || t.markerDx,
                dy: t.textDy || t.markerDy
            }),
            n
        }
        it(t, r),
        t.test = function(t, e) {
            if (!e.getLayer())
                return !1;
            var i = e.getJSONType();
            return "Marker" === i || "LineString" === i
        }
        ;
        var e = t.prototype;
        return e.symbolize = function(t) {
            if (this.geometry.getLayer().options.drawAltitude && this.geometry.hasAltitude()) {
                var e = this._getStyle();
                if (this._prepareContext(t),
                "LineString" === this.geometry.type) {
                    var i = this._getPaintParams(e.lineDx, e.lineDy, !1, !0);
                    if (!i)
                        return;
                    var n = this.getPainter().getPaintParams(e.lineDx, e.lineDy, !0, !0, "_groundpt")[0];
                    this._drawLineAltitude(t, i[0], n)
                } else {
                    var r = this._getRenderContainerPoints()
                      , o = this._getRenderContainerPoints(!0);
                    if (!r || 0 === r.length)
                        return;
                    this._drawMarkerAltitude(t, r[0], o[0])
                }
            }
        }
        ,
        e.getDxDy = function() {
            var t = this.dxdy;
            return new dt(t.dx || 0,t.dy || 0)
        }
        ,
        e.get2DExtent = function() {
            return "LineString" === this.geometry.type ? ks.prototype.get2DExtent.apply(this) : r.prototype.get2DExtent.call(this)
        }
        ,
        e.getPlacement = function() {
            return "point"
        }
        ,
        e._getPaintParams = function(t, e) {
            return this.getPainter().getPaintParams(t || 0, e || 0, null, !0, "_altpt")
        }
        ,
        e._drawMarkerAltitude = function(t, e, i) {
            var n = this._getStyle();
            this.prepareCanvas(t, n),
            Gn.path(t, [e, i], n.lineOpacity, null, n.lineDasharray)
        }
        ,
        e._drawLineAltitude = function(t, e, i) {
            var n = this._getStyle();
            if (0 < e.length && Array.isArray(e[0]))
                for (var r = 0; r < e.length; r++)
                    this._drawLine(t, e[r], i[r]);
            else
                this._drawLine(t, e, i);
            t.setLineDash && Array.isArray(n.lineDasharray) && t.setLineDash([])
        }
        ,
        e._drawLine = function(t, e, i) {
            var n = this._getStyle();
            this.prepareCanvas(t, n);
            for (var r = 0, o = e.length - 1; r < o; r++)
                Gn.polygon(t, [e[r], e[r + 1], i[r + 1], i[r]], n.lineOpacity, n.polygonOpacity, n.lineDasharray)
        }
        ,
        e._getStyle = function() {
            var t = this.geometry.getLayer().options.drawAltitude;
            return _(t) || (t = Hs),
            t.lineWidth || (t.lineWidth = 0,
            t.lineOpacity = 0),
            t
        }
        ,
        t
    }(Ps), Ns = Object.freeze({
        Symbolizer: ps,
        CanvasSymbolizer: ms,
        DebugSymbolizer: Ms,
        ImageMarkerSymbolizer: Es,
        PointSymbolizer: Ps,
        StrokeAndFillSymbolizer: ks,
        TextMarkerSymbolizer: Ds,
        VectorMarkerSymbolizer: Fs,
        VectorPathMarkerSymbolizer: Gs,
        DrawAltitudeSymbolizer: Bs
    }), Zs = [Bs, ks, Es, Gs, Fs, Ds], Ws = new dt(0,0), Vs = new Vr, Us = new Vr, Js = new Vr, qs = new Vr, Xs = new Vr, Ys = {}, Qs = {
        minx: 1 / 0,
        miny: 1 / 0,
        maxx: -1 / 0,
        maxy: -1 / 0
    }, Ks = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this) || this).geometry = t,
            e.symbolizers = e._createSymbolizers(),
            e._altAtGL = e._getGeometryAltitude(),
            e.bbox = Rn(),
            e._drawTime = 0,
            e
        }
        it(t, i);
        var e = t.prototype;
        return e._setDrawTime = function(t) {
            return this._drawTime = t,
            this
        }
        ,
        e.getRenderBBOX = function() {
            var t = this.getLayer();
            if (t && t._drawTime !== this._drawTime)
                return null;
            kn(this.bbox);
            for (var e = this.symbolizers.length - 1; 0 <= e; e--) {
                var i = this.symbolizers[e].bbox;
                Dn(i) && Ln(this.bbox, i)
            }
            return Dn(this.bbox) ? this.bbox : null
        }
        ,
        e.getMap = function() {
            return this.geometry.getMap()
        }
        ,
        e.getLayer = function() {
            return this.geometry && this.geometry.getLayer()
        }
        ,
        e._createSymbolizers = function() {
            var t = this.getSymbol()
              , e = []
              , i = Zs
              , n = t;
            Array.isArray(t) || (n = [t]);
            for (var r = n.length - 1; 0 <= r; r--)
                for (var o = n[r], s = i.length - 1; 0 <= s; s--)
                    if (i[s].test(o, this.geometry)) {
                        var a = new i[s](o,this.geometry,this);
                        a._index = r,
                        e.push(a),
                        a instanceof Ps && (this._hasPoint = !0)
                    }
            if (!e.length && console) {
                var h = this.geometry.getId();
                console.warn("invalid symbol for geometry(" + (this.geometry ? this.geometry.getType() + (h ? ":" + h : "") : "") + ") to draw : " + JSON.stringify(t))
            }
            return this._debugSymbolizer = new Ms(t,this.geometry,this),
            e
        }
        ,
        e.hasPoint = function() {
            return !!this._hasPoint
        }
        ,
        e.getRenderPoints = function(t) {
            return this._verifyProjection(),
            this._renderPoints || (this._renderPoints = {}),
            t || (t = "center"),
            this._renderPoints[t] || (this._renderPoints[t] = this.geometry._getRenderPoints(t)),
            this._renderPoints[t]
        }
        ,
        e.getPaintParams = function(t, e, i, n, r) {
            void 0 === r && (r = "_pt");
            var o, s, a, h, l, u = this.getLayer()._getRenderer().mapStateCache, c = this.getMap();
            u && !this._hitPoint ? (o = u.resolution,
            s = u.pitch,
            a = u.bearing,
            h = u.glScale,
            l = u.containerExtent) : (o = c.getResolution(),
            s = c.getPitch(),
            a = c.getBearing(),
            h = c.getGLScale(),
            l = c.getContainerExtent());
            var d = this.geometry
              , f = o
              , g = 0 !== s
              , p = 0 !== a
              , m = this._cachedParams
              , _ = d._paintAsPath && d._paintAsPath();
            if (_ && this._unsimpledParams && f <= this._unsimpledParams._res)
                m = this._unsimpledParams;
            else if (!m || m._res !== o || this._pitched !== g && d._redrawWhenPitch() || this._rotated !== p && d._redrawWhenRotate()) {
                if (!(m = d._getPaintParams()))
                    return null;
                m._res = f,
                !d._simplified && _ && (this._unsimpledParams || (this._unsimpledParams = m),
                f > this._unsimpledParams._res && (this._unsimpledParams._res = f)),
                this._cachedParams = m
            }
            if (!m)
                return null;
            this._pitched = g,
            this._rotated = p;
            var v = h
              , y = []
              , x = m[0]
              , w = l
              , C = this._pointContainerPoints(x, t, e, i, n || this._hitPoint && !w.contains(this._hitPoint), null, r);
            if (!C)
                return null;
            y.push(C);
            for (var b = 1, P = m.length; b < P; b++)
                G(m[b]) || m[b]instanceof Oe ? G(m[b]) ? y.push(m[b] / v) : y.push(m[b].multi(1 / v)) : y.push(m[b]);
            return y
        }
        ,
        e._pointContainerPoints = function(t, h, l, e, i, n, u) {
            if (void 0 === u && (u = "_pt"),
            this._aboveCamera())
                return null;
            var c, d, r, o = this.getLayer()._getRenderer(), s = o.mapStateCache, f = this.getMap(), g = this.geometry, p = this.containerOffset;
            s ? (c = s.glRes,
            d = s.containerExtent) : (c = f.getGLRes(),
            d = f.getContainerExtent());
            var m = this.getLayer().options.roundPoint
              , _ = 1 / 0
              , v = 1 / 0
              , y = -1 / 0
              , x = -1 / 0
              , w = !i
              , C = o.layer.options.clipBBoxBufferSize || 3
              , b = this.symbolizers;
            function a(t, e) {
                void 0 === t && (t = []),
                void 0 === e && (e = []);
                for (var i = Bt(t, u), n = 0, r = (i = f._pointsAtResToContainerPoints(t, c, e, i)).length; n < r; n++) {
                    var o = i[n];
                    o._sub(p),
                    (h || l) && o._add(h || 0, l || 0),
                    m && (o.x = Math.ceil(o.x),
                    o.y = Math.ceil(o.y)),
                    _ = Math.min(o.x, _),
                    v = Math.min(o.y, v),
                    y = Math.max(o.x, y),
                    x = Math.max(o.y, x)
                }
                if (w && ai(b)) {
                    if (Xs.ymin = d.ymin,
                    Xs.ymin < C && (Xs.ymin = d.ymin - C),
                    Xs.xmin = d.xmin - C,
                    Xs.xmax = d.xmax + C,
                    Xs.ymax = d.ymax + C,
                    g.getShell && g.getHoles)
                        return cs(i, Xs);
                    var s = ls(i, Xs, !1);
                    if (s.length) {
                        var a = [];
                        return s.forEach(function(t) {
                            for (var e = 0, i = t.length; e < i; e++)
                                a.push(t[e].point)
                        }),
                        a
                    }
                }
                return i
            }
            var P = this.getAltitude();
            if (Array.isArray(t)) {
                var M, T = this.geometry;
                !i && T.options.enableClip ? (M = this._clip(t, P)).inView && (w = !1) : M = {
                    points: t,
                    altitude: P
                };
                var S = M.points;
                P = M.altitude,
                e && (P = 0);
                var E = P;
                r = [];
                for (var R = [], A = G(P), k = 0, O = S.length; k < O; k++) {
                    var L = S[k];
                    if (Array.isArray(L)) {
                        if (A) {
                            var D = a(L, P);
                            r.push(D);
                            continue
                        }
                        for (var I = [], z = 0, j = L.length; z < j; z++)
                            Array.isArray(P) && (E = P[k] ? P[k][z] : 0),
                            I.push(E);
                        var F = a(L, I);
                        r.push(F)
                    } else
                        Array.isArray(P) && (E = "vertex-last" === n ? P[P.length - 1 - k] : "line" === n ? (P[k] + P[k + 1]) / 2 : P[k]),
                        R.push(E)
                }
                R.length && (r = a(S, R))
            } else
                t instanceof dt && (e && (P = 0),
                r = f._pointAtResToContainerPoint(t, c, P)._sub(p),
                (h || l) && r._add(h, l));
            return Qs.minx = _,
            Qs.miny = v,
            Qs.maxx = y,
            Qs.maxy = x,
            this._containerBbox = Qs,
            r
        }
        ,
        e._clip = function(t, e) {
            if (G(e) && 0 !== e)
                return {
                    points: t,
                    altitude: e
                };
            if (Array.isArray(e)) {
                for (var i = !1, n = 0, r = e.length; n < r; n++)
                    if (0 !== e[n]) {
                        i = !0;
                        break
                    }
                if (i)
                    return {
                        points: t,
                        altitude: e
                    }
            }
            var o = this.getMap()
              , s = this.geometry
              , a = this.getSymbol().lineWidth;
            G(a) || (a = 4);
            var h, l, u, c = this.getLayer()._getRenderer().mapStateCache;
            c ? (h = c._2DExtent,
            l = c.glExtent,
            u = c.pitch) : (h = o._get2DExtent(),
            l = o._get2DExtentAtRes(o.getGLRes()),
            u = o.getPitch());
            var d = h._expand(a);
            if (0 < u && e) {
                var f = o.cameraLookAt
                  , g = o.cameraPosition;
                Ws.set(g.x, g.y),
                d = d._combine(Ws._add(bt(f[0] - g[0]), bt(f[1] - g[1])))
            }
            var p = t;
            if (this.get2DExtent(null, qs).within(d))
                return {
                    points: p,
                    altitude: e,
                    inView: !0
                };
            var m = l._expand(a * o._glScale);
            Js.xmin = m.xmin,
            Js.xmax = m.xmax,
            Js.ymin = m.ymin,
            Js.ymax = m.ymax;
            var _ = s.options.smoothness;
            if (s.getShell && this.geometry.getHoles && !_) {
                var v = m.xmin
                  , y = m.ymin
                  , x = m.xmax
                  , w = m.ymax
                  , C = Math.abs(x - v)
                  , b = Math.abs(w - y)
                  , P = Math.sqrt(C * C + b * b)
                  , M = (P - C) / 2
                  , T = (P - b) / 2;
                if (Js.xmin = m.xmin - M,
                Js.xmax = m.xmax + M,
                Js.ymin = m.ymin - T,
                Js.ymax = m.ymax + T,
                Array.isArray(t[0])) {
                    p = [];
                    for (var S = 0; S < t.length; S++) {
                        var E = cs(t[S], Js);
                        E.length && p.push(E)
                    }
                } else
                    p = cs(t, Js)
            } else if ("LineString" === s.getJSONType() && !_) {
                if (Array.isArray(t[0])) {
                    p = [];
                    for (var R = 0; R < t.length; R++)
                        yt(p, ls(t[R], Js, !1, !!_))
                } else
                    p = ls(t, Js, !1, !!_);
                return this._interpolateSegAlt(p, t, e)
            }
            return {
                points: p,
                altitude: e
            }
        }
        ,
        e._interpolateSegAlt = function(t, e, n) {
            if (!Array.isArray(n)) {
                var i = function(t) {
                    return t.point
                };
                return {
                    points: t.map(function(t) {
                        return Array.isArray(t) ? t.map(i) : t.point
                    }),
                    altitude: n
                }
            }
            var r = function t(e, i, n) {
                if (!Array.isArray(n))
                    return e;
                var r = [];
                for (var o = 0, s = e.length; o < s; o++)
                    if (Array.isArray(e[o]))
                        r.push(t(e[o], i, n));
                    else {
                        var a = e[o];
                        if (a.point.equals(i[a.index]))
                            a.altitude = n[a.index],
                            r.push(a);
                        else {
                            var h = void 0
                              , l = void 0;
                            0 === a.index ? (h = a.index,
                            l = a.index + 1) : (h = a.index - 1,
                            l = a.index);
                            var u = a.point.distanceTo(i[l])
                              , c = u / (u + i[h].distanceTo(a.point))
                              , d = Pt(n[h], n[l], 1 - c);
                            a.altitude = d,
                            r.push(a)
                        }
                    }
                return r
            }(t, e, n);
            return n = [],
            {
                points: r.map(function(t) {
                    if (Array.isArray(t)) {
                        var e = []
                          , i = t.map(function(t) {
                            return e.push(t.altitude),
                            t.point
                        });
                        return n.push(e),
                        i
                    }
                    return n.push(t.altitude),
                    t.point
                }),
                altitude: n
            }
        }
        ,
        e.getSymbol = function() {
            return this.geometry._getInternalSymbol()
        }
        ,
        e._resetSymbolizersBBOX = function() {
            for (var t = this.symbolizers.length - 1; 0 <= t; t--) {
                kn(this.symbolizers[t].bbox)
            }
            return this
        }
        ,
        e.paint = function(t, e, i) {
            if (this.symbolizers) {
                var n = this.getLayer()
                  , r = n._getRenderer();
                if (r && (r.context || e)) {
                    var o = r.mapStateCache || {};
                    if (this.geometry._isCheck || !t || t.intersects(this.get2DExtent(r.resources, Vs))) {
                        var s = this.getMap();
                        if (!this._aboveCamera()) {
                            this.containerOffset = i || o.offset || s._pointToContainerPoint(r.middleWest)._add(0, -s.height / 2),
                            this._beforePaint();
                            var a = e || r.context;
                            a.isHitTesting || this._resetSymbolizersBBOX();
                            for (var h = [a, r.resources], l = this.symbolizers.length - 1; 0 <= l; l--)
                                (a.shadowBlur || this.symbolizers[l].symbol.shadowBlur) && this._prepareShadow(a, this.symbolizers[l].symbol),
                                this.symbolizers[l].symbolize.apply(this.symbolizers[l], h);
                            this._afterPaint(),
                            this._painted = !0,
                            (this.geometry.options.debug || n.options.debug) && this._debugSymbolizer.symbolize.apply(this._debugSymbolizer, h)
                        }
                    }
                }
            }
        }
        ,
        e.getSprite = function(i, t) {
            if (!this.geometry.isPoint)
                return null;
            if (this._spriting = !0,
            !this._sprite && 0 < this.symbolizers.length) {
                var n = new Vr;
                this.symbolizers.forEach(function(t) {
                    var e = t.getFixedExtent(i);
                    n._combine(e)
                });
                var e, r = n.getMin().multi(-1), o = t || (this.getMap() ? this.getMap().CanvasClass : null), s = Gn.createCanvas(n.getWidth(), n.getHeight(), o);
                this._renderPoints && (e = this._renderPoints);
                for (var a = s.getContext("2d"), h = [a, i], l = this.symbolizers.length - 1; 0 <= l; l--) {
                    var u = this.symbolizers[l].getDxDy();
                    this._renderPoints = {
                        center: [[r.add(u)]]
                    },
                    this._prepareShadow(a, this.symbolizers[l].symbol),
                    this.symbolizers[l].symbolize.apply(this.symbolizers[l], h)
                }
                e && (this._renderPoints = e),
                this._sprite = {
                    canvas: s,
                    offset: n.getCenter()
                }
            }
            return this._spriting = !1,
            this._sprite
        }
        ,
        e.isSpriting = function() {
            return !!this._spriting
        }
        ,
        e.hitTest = function(t, e) {
            if ((!e || e < .5) && (e = .5),
            this._hitPoint = t.sub(e, e),
            !Os) {
                var i = this.getMap() ? this.getMap().CanvasClass : null;
                Os = Gn.createCanvas(1, 1, i)
            }
            Gn.setHitTesting(!0),
            Os.width = Os.height = 2 * e;
            var n = Gn.getCanvas2DContext(Os);
            n.isHitTesting = !0;
            try {
                this.paint(null, n, this._hitPoint)
            } catch (t) {
                throw t
            } finally {
                Gn.setHitTesting(!1)
            }
            delete this._hitPoint;
            for (var r = n.getImageData(0, 0, Os.width, Os.height).data, o = 3, s = r.length; o < s; o += 4)
                if (0 < r[o])
                    return !0;
            return !1
        }
        ,
        e.isHitTesting = function() {
            return !!this._hitPoint
        }
        ,
        e._prepareShadow = function(t, e) {
            e.shadowBlur ? (t.shadowBlur = this.isHitTesting() ? 0 : e.shadowBlur,
            t.shadowColor = e.shadowColor || "#000",
            t.shadowOffsetX = e.shadowOffsetX || 0,
            t.shadowOffsetY = e.shadowOffsetY || 0) : t.shadowBlur && (t.shadowBlur = null,
            t.shadowColor = null,
            t.shadowOffsetX = null,
            t.shadowOffsetY = null)
        }
        ,
        e._eachSymbolizer = function(t, e) {
            if (this.symbolizers) {
                e || (e = this);
                for (var i = this.symbolizers.length - 1; 0 <= i; i--)
                    t.apply(e, [this.symbolizers[i]])
            }
        }
        ,
        e.get2DExtent = function(t, e) {
            this._verifyProjection();
            var i = this.getMap();
            t = t || this.getLayer()._getRenderer().resources;
            var n = i.getZoom()
              , r = this._isDynamicSize();
            if (this._extent2D && this._extent2D._zoom === n && this._fixedExtent || (this._extent2D && this._extent2D._zoom !== n && delete this._extent2D,
            this.symbolizers && (this._extent2D || (this._extent2D = this._computeExtent2D(new Vr),
            this._extent2D._zoom = n),
            this._fixedExtent || (this._fixedExtent = this._computeFixedExtent(t, new Vr)))),
            !this._extent2D)
                return r && delete this._fixedExtent,
                null;
            var o = this._fixedExtent
              , s = o.xmin
              , a = o.ymin
              , h = o.xmax
              , l = o.ymax;
            return r && delete this._fixedExtent,
            Us.set(s, -l, h, -a),
            e ? (e.set(this._extent2D.xmin, this._extent2D.ymin, this._extent2D.xmax, this._extent2D.ymax),
            e._add(Us),
            e) : this._extent2D.add(Us)
        }
        ,
        e._computeExtent2D = function(t) {
            for (var e = this.symbolizers.length - 1; 0 <= e; e--) {
                var i = this.symbolizers[e];
                t._combine(i.get2DExtent())
            }
            return t
        }
        ,
        e._computeFixedExtent = function(t, e) {
            for (var i = this.symbolizers.length - 1; 0 <= i; i--) {
                var n = this.symbolizers[i];
                n.getFixedExtent && e._combine(n.getFixedExtent(t))
            }
            return e
        }
        ,
        e._isDynamicSize = function() {
            for (var t = this.symbolizers.length - 1; 0 <= t; t--) {
                if (this.symbolizers[t].isDynamicSize())
                    return !0
            }
            return !1
        }
        ,
        e._aboveCamera = function() {
            var t = this.getMinAltitude()
              , e = this.getMap()
              , i = e.getGLRes();
            t = e.altitudeToPoint(t, i) * bt(t);
            var n = e.getFrustumAltitude();
            return t && n && n < t
        }
        ,
        e.getFixedExtent = function() {
            var t = this.getMap().getZoom();
            return this._isDynamicSize() ? this._computeFixedExtent(null, new Vr) : (this._extent2D && this._extent2D._zoom === t || this.get2DExtent(null, Us),
            this._fixedExtent)
        }
        ,
        e.setZIndex = function(e) {
            this._eachSymbolizer(function(t) {
                t.setZIndex(e)
            })
        }
        ,
        e.show = function() {
            this._painted ? (this.removeCache(),
            this._eachSymbolizer(function(t) {
                t.show()
            })) : this.getLayer().isCanvasRender() || this.paint()
        }
        ,
        e.hide = function() {
            this._eachSymbolizer(function(t) {
                t.hide()
            })
        }
        ,
        e.repaint = function() {
            this._altAtGL = this._getGeometryAltitude(),
            this.removeCache();
            var t = this.getLayer();
            if (t) {
                var e = t.getRenderer();
                e && e.setToRedraw() && e.setToRedraw()
            }
        }
        ,
        e.refreshSymbol = function() {
            this.removeCache(),
            this._removeSymbolizers(),
            this.symbolizers = this._createSymbolizers()
        }
        ,
        e.remove = function() {
            this.removeCache(),
            this._removeSymbolizers()
        }
        ,
        e._removeSymbolizers = function() {
            this._eachSymbolizer(function(t) {
                delete t.painter,
                t.remove()
            }),
            delete this.symbolizers
        }
        ,
        e.removeCache = function() {
            delete this._renderPoints,
            delete this._paintParams,
            delete this._sprite,
            delete this._extent2D,
            delete this._fixedExtent,
            delete this._cachedParams,
            delete this._unsimpledParams
        }
        ,
        e.getAltitude = function() {
            return this.geometry._getAltitude() !== this._propAlt && (this._altAtGL = this._getGeometryAltitude()),
            this._altAtGL ? this._altAtGL : 0
        }
        ,
        e.getMinAltitude = function() {
            return this.minAltitude ? this.minAltitude : 0
        }
        ,
        e.getMaxAltitude = function() {
            return this.maxAltitude ? this.maxAltitude : 0
        }
        ,
        e._getGeometryAltitude = function() {
            var n = this;
            if (!this.getMap())
                return 0;
            var t = this.geometry._getAltitude();
            return (this._propAlt = t) ? this.geometry.getCenter() ? Array.isArray(t) ? (this.minAltitude = Number.MAX_VALUE,
            this.maxAltitude = Number.MIN_VALUE,
            t.map(function(t) {
                var e = Array.isArray(t);
                e || (t = [t]);
                var i = t.map(function(t) {
                    var e = t;
                    return e < n.minAltitude && (n.minAltitude = e),
                    e > n.maxAltitude && (n.maxAltitude = e),
                    e
                });
                return e ? i : i[0]
            })) : (this.minAltitude = this.maxAltitude = t,
            this.minAltitude) : 0 : (this.minAltitude = this.maxAltitude = 0,
            0)
        }
        ,
        e._verifyProjection = function() {
            var t = this.geometry._getProjection() || Ys;
            this._projCode && this._projCode !== t.code && this.removeCache(),
            this._projCode = t.code
        }
        ,
        e._beforePaint = function() {}
        ,
        e._afterPaint = function() {}
        ,
        t
    }(qn);
    var $s = new Vr
      , ta = function(n) {
        function t(t, e) {
            var i;
            return (i = n.call(this) || this).geometry = t,
            i.isMask = e,
            i.bbox = Rn(),
            i._drawTime = 0,
            i
        }
        it(t, n);
        var e = t.prototype;
        return e._setDrawTime = function(e) {
            return this._drawTime = e,
            this._eachPainter(function(t) {
                t._setDrawTime(e)
            }),
            this
        }
        ,
        e.getRenderBBOX = function() {
            var i = this
              , t = this.getLayer();
            return t && t._drawTime !== this._drawTime ? null : (kn(this.bbox),
            this._eachPainter(function(t) {
                var e = t.getRenderBBOX();
                Dn(e) && Ln(i.bbox, e)
            }),
            Dn(this.bbox) ? this.bbox : null)
        }
        ,
        e._eachPainter = function(t) {
            for (var e, i = this.geometry.getGeometries(), n = 0, r = i.length; n < r && (!(e = this.isMask ? i[n]._getMaskPainter() : i[n]._getPainter()) || !e || !1 !== t.call(this, e)); n++)
                ;
        }
        ,
        e.getLayer = function() {
            return this.geometry && this.geometry.getLayer()
        }
        ,
        e.paint = function(e) {
            this.geometry && this._eachPainter(function(t) {
                t.paint(e)
            })
        }
        ,
        e.get2DExtent = function(e, t) {
            t && t.set(null, null, null, null);
            var i = t || new Vr;
            return this._eachPainter(function(t) {
                i = i._combine(t.get2DExtent(e, $s))
            }),
            i
        }
        ,
        e.remove = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.remove.apply(t, e)
            })
        }
        ,
        e.setZIndex = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.setZIndex.apply(t, e)
            })
        }
        ,
        e.show = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.show.apply(t, e)
            })
        }
        ,
        e.hide = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.hide.apply(t, e)
            })
        }
        ,
        e.repaint = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.repaint.apply(t, e)
            })
        }
        ,
        e.refreshSymbol = function() {
            var e = arguments;
            this._eachPainter(function(t) {
                t.refreshSymbol.apply(t, e)
            })
        }
        ,
        e.hasPoint = function() {
            var e = !1;
            return this._eachPainter(function(t) {
                return !t.hasPoint() || !(e = !0)
            }),
            e
        }
        ,
        e.getMinAltitude = function() {
            var i = !0
              , n = 0;
            return this._eachPainter(function(t) {
                var e = t.getMinAltitude();
                (i || e < n) && (i = !1,
                n = e)
            }),
            n
        }
        ,
        e.getMaxAltitude = function() {
            var i = 0;
            return this._eachPainter(function(t) {
                var e = t.getMaxAltitude();
                i < e && (i = e)
            }),
            i
        }
        ,
        t
    }(qn)
      , ea = {
        "EPSG:3857": {
            projection: "EPSG:3857",
            resolutions: function() {
                for (var t = [], e = 12756274 * Math.PI, i = 0; i < 23; i++)
                    t[i] = e / (256 * Math.pow(2, i));
                return t
            }(),
            fullExtent: {
                top: 6378137 * Math.PI,
                left: -6378137 * Math.PI,
                bottom: -6378137 * Math.PI,
                right: 6378137 * Math.PI
            }
        },
        "EPSG:4326": {
            projection: "EPSG:4326",
            fullExtent: {
                top: 90,
                left: -180,
                bottom: -90,
                right: 180
            },
            resolutions: function() {
                for (var t = [], e = 0; e < 23; e++)
                    t[e] = 180 / (128 * Math.pow(2, e));
                return t
            }()
        },
        BAIDU: {
            projection: "baidu",
            resolutions: function() {
                for (var t = Math.pow(2, 18), e = [], i = 0; i < 23; i++)
                    e[i] = t,
                    t *= .5;
                return e
            }(),
            fullExtent: {
                top: 33554432,
                left: -33554432,
                bottom: -33554432,
                right: 33554432
            }
        },
        IDENTITY: {
            projection: "identity",
            resolutions: function() {
                for (var t = Math.pow(2, 8), e = [], i = 0; i < 23; i++)
                    e[i] = t,
                    t *= .5;
                return e
            }(),
            fullExtent: {
                top: 2e5,
                left: -2e5,
                bottom: -2e5,
                right: 2e5
            }
        },
        "PRESET-VT-3857": {
            projection: "EPSG:3857",
            resolutions: function() {
                for (var t = [], e = 6378137 * Math.PI, i = 0; i < 23; i++)
                    t[i] = e / (256 * Math.pow(2, i));
                return t
            }(),
            fullExtent: {
                top: 6378137 * Math.PI,
                left: -6378137 * Math.PI,
                bottom: -6378137 * Math.PI,
                right: 6378137 * Math.PI
            }
        },
        "PRESET-VT-4326": {
            projection: "EPSG:4326",
            fullExtent: {
                top: 90,
                left: -180,
                bottom: -90,
                right: 180
            },
            resolutions: function() {
                for (var t = [], e = 0; e < 23; e++)
                    t[e] = 45 / (128 * Math.pow(2, e));
                return t
            }()
        }
    };
    ea["EPSG:4490"] = ea["EPSG:4326"],
    ea["PRESET-3857-512"] = ea["PRESET-VT-3857"],
    ea["PRESET-4326-512"] = ea["PRESET-VT-4326"];
    var ia = function() {
        function a(t) {
            void 0 === t && (t = {}),
            this.options = t,
            this._initSpatialRef()
        }
        a.registerPreset = function(t, e) {
            t = t && t.toUpperCase(),
            ea[t] && console.warn("Spatial reference " + t + " already registered."),
            ea[t] = e
        }
        ,
        a.getPreset = function(t) {
            return ea[t.toUpperCase()]
        }
        ,
        a.getAllPresets = function() {
            return Object.keys(ea)
        }
        ,
        a.getProjectionInstance = function(t) {
            if (!t)
                return null;
            if (P(t) && (t = {
                code: t
            }),
            t.project)
                return t.locate || ("identity" === (t = F({}, t)).measure ? F(t, no.getInstance("IDENTITY")) : F(t, no.getInstance("EPSG:4326"))),
                t;
            var e = (t.code + "").toLowerCase();
            for (var i in Eo)
                if (v(Eo, i)) {
                    var n = Eo[i].aliases || []
                      , r = Eo[i].code;
                    n.push(r);
                    for (var o = 0; o < n.length; o++)
                        if (n[o].toLowerCase() === e) {
                            if (Eo[i].create) {
                                var s = Eo[i].create(t);
                                return s.code = n[o],
                                s
                            }
                            if (Eo[i].code === n[o])
                                return Eo[i];
                            var a = F({}, Eo[i]);
                            return a.code = n[o],
                            a
                        }
                }
            return null
        }
        ,
        a.equals = function(t, e) {
            if (P(t) || P(e))
                return t === e;
            if (!t && !e)
                return !0;
            if (!t || !e)
                return !1;
            if (t.projection !== e.projection)
                return !1;
            var i = t.fullExtent
              , n = e.fullExtent;
            if (i && !n || !i && n)
                return !1;
            if (i && n && (i.top !== n.top || i.bottom !== n.bottom || i.left !== n.left || i.right !== n.right))
                return !1;
            var r = t.resolutions
              , o = e.resolutions;
            if (r && o) {
                if (r.length !== o.length)
                    return !1;
                for (var s = 0; s < r.length; s++)
                    if (r[s] !== o[s])
                        return !1
            } else if (r || o)
                return !1;
            return !0
        }
        ;
        var t = a.prototype;
        return t._initSpatialRef = function() {
            var t = this.options.projection;
            if (!(t = t ? a.getProjectionInstance(t) : So))
                throw new Error("must provide a valid projection in map's spatial reference.");
            (t = F({}, Jr, t)).measureLength || F(t, no.DEFAULT),
            this._projection = t;
            var e, i = this.options.resolutions;
            if (!i && (t.code && (e = ea[t.code.toUpperCase()]) && (i = e.resolutions,
            this.isEPSG = "IDENTITY" !== t.code),
            !i))
                throw new Error("must provide valid resolutions in map's spatial reference.");
            if (this._resolutions = i,
            this._pyramid = !0,
            this._pyramid)
                for (var n = 0; n < i.length; n++)
                    if (i[n] && i[n - 1] && i[n - 1] / i[n] != 2) {
                        this._pyramid = !1;
                        break
                    }
            var r = this.options.fullExtent;
            if (!r && (t.code && (e = ea[t.code.toUpperCase()]) && (r = e.fullExtent),
            !r))
                throw new Error("must provide a valid fullExtent in map's spatial reference.");
            if (ut(r.left) ? (this._fullExtent = new Zr(r),
            r.left = r.xmin,
            r.right = r.xmax,
            r.top = r.ymax,
            r.bottom = r.ymin) : this._fullExtent = new Zr(new Rr(r.left,r.top),new Rr(r.right,r.bottom)),
            ut(r.top) || ut(r.bottom) || ut(r.left) || ut(r.right))
                throw new Error("must provide valid top/bottom/left/right in fullExtent.");
            F(this._fullExtent, r);
            var o = (this._projection.fullExtent = r).right >= r.left ? 1 : -1
              , s = r.top >= r.bottom ? -1 : 1;
            this._transformation = new Ur([o, s, 0, 0])
        }
        ,
        t.getResolutions = function() {
            return this._resolutions || []
        }
        ,
        t.getResolution = function(t) {
            var e = 0 | t;
            e < 0 ? e = 0 : e > this._resolutions.length - 1 && (e = this._resolutions.length - 1);
            var i = this._resolutions[e];
            return e !== t && 0 < t && e < this._resolutions.length - 1 ? i + (this._resolutions[e + 1] - i) * (t - e) : i
        }
        ,
        t.getProjection = function() {
            return this._projection
        }
        ,
        t.getFullExtent = function() {
            return this._fullExtent
        }
        ,
        t.getTransformation = function() {
            return this._transformation
        }
        ,
        t.getMinZoom = function() {
            for (var t = 0; t < this._resolutions.length; t++)
                if (!ut(this._resolutions[t]))
                    return t;
            return 0
        }
        ,
        t.getMaxZoom = function() {
            for (var t = this._resolutions.length - 1; 0 <= t; t--)
                if (!ut(this._resolutions[t]))
                    return t;
            return this._resolutions.length - 1
        }
        ,
        t.getZoomDirection = function() {
            return bt(this._resolutions[this.getMinZoom()] - this._resolutions[this.getMaxZoom()])
        }
        ,
        t.toJSON = function() {
            return this.json || (this.json = {
                resolutions: this._resolutions,
                fullExtent: {
                    top: this._fullExtent.top,
                    left: this._fullExtent.left,
                    bottom: this._fullExtent.bottom,
                    right: this._fullExtent.right
                },
                projection: this._projection.code
            }),
            this.json
        }
        ,
        t.isPyramid = function() {
            return this._pyramid
        }
        ,
        a
    }()
      , na = new dt(0,0)
      , ra = new Vr
      , oa = {};
    var sa = function(s) {
        function i(t) {
            var e, i = F({}, t), n = i.symbol, r = i.properties, o = i.id;
            return delete i.symbol,
            delete i.id,
            delete i.properties,
            e = s.call(this, i) || this,
            n ? e.setSymbol(n) : e._genSizeSymbol(),
            r && e.setProperties(r),
            ut(o) || e.setId(o),
            e
        }
        it(i, s);
        var t = i.prototype;
        return t.getFirstCoordinate = function() {
            if ("GeometryCollection" === this.type) {
                var t = this.getGeometries();
                return t.length ? t[0].getFirstCoordinate() : null
            }
            var e = this.getCoordinates();
            if (!Array.isArray(e))
                return e;
            for (; e = e[0],
            Array.isArray(e) && 0 < e.length; )
                ;
            return e
        }
        ,
        t.getLastCoordinate = function() {
            if ("GeometryCollection" === this.type) {
                var t = this.getGeometries();
                return t.length ? t[t.length - 1].getLastCoordinate() : null
            }
            var e = this.getCoordinates();
            if (!Array.isArray(e))
                return e;
            for (; e = e[e.length - 1],
            Array.isArray(e) && 0 < e.length; )
                ;
            return e
        }
        ,
        t.addTo = function(t, e) {
            return t.addGeometry(this, e),
            this
        }
        ,
        t.getLayer = function() {
            return this._layer ? this._layer : null
        }
        ,
        t.getMap = function() {
            return this._layer ? this._layer.getMap() : null
        }
        ,
        t.getId = function() {
            return this._id
        }
        ,
        t.setId = function(t) {
            var e = this.getId();
            return this._id = t,
            this._fireEvent("idchange", {
                old: e,
                new: t
            }),
            this
        }
        ,
        t.getProperties = function() {
            return this.properties ? this.properties : this._getParent() ? this._getParent().getProperties() : null
        }
        ,
        t.setProperties = function(t) {
            var e = this.properties;
            return this.properties = _(t) ? F({}, t) : t,
            this._clearAltitudeCache(),
            this._repaint(),
            this._fireEvent("propertieschange", {
                old: e,
                new: t
            }),
            this
        }
        ,
        t.getType = function() {
            return this.type
        }
        ,
        t.getSymbol = function() {
            var t = this._symbol;
            return t ? Array.isArray(t) ? ei(t) : F({}, t) : null
        }
        ,
        t.setSymbol = function(t) {
            return this._symbolUpdated = t,
            this._symbol = this._prepareSymbol(t),
            this.onSymbolChanged(),
            delete this._compiledSymbol,
            delete this._symbolHash,
            this
        }
        ,
        t.getSymbolHash = function() {
            return this._symbolHash || (this._symbolHash = $e(this._symbolUpdated)),
            this._symbolHash
        }
        ,
        t.updateSymbol = function(t) {
            if (!t)
                return this;
            var e = this._getSymbol();
            if (Array.isArray(e)) {
                if (!Array.isArray(t))
                    throw new Error("Parameter of updateSymbol is not an array.");
                for (var i = 0; i < t.length; i++)
                    es(t[i]) && delete this._textDesc,
                    e[i] && t[i] && (e[i] = ei(e[i], t[i]))
            } else {
                if (Array.isArray(t))
                    throw new Error("Geometry's symbol is not an array to update.");
                es(e) && delete this._textDesc,
                e = ei(e || this._getInternalSymbol(), t)
            }
            return this._eventSymbolProperties = t,
            delete this._compiledSymbol,
            this.setSymbol(e)
        }
        ,
        t.getTextContent = function() {
            var t = this._getInternalSymbol();
            if (Array.isArray(t)) {
                for (var e = [], i = !1, n = 0; n < t.length; n++)
                    e[n] = Ne(t[n] && t[n].textName, this.getProperties()),
                    ut(e[n]) || (i = !0);
                return i ? e : null
            }
            return Ne(t && t.textName, this.getProperties())
        }
        ,
        t.getTextDesc = function() {
            if (!this._textDesc) {
                var i = this.getTextContent()
                  , t = this._sizeSymbol
                  , n = Array.isArray(i);
                Array.isArray(t) ? this._textDesc = t.map(function(t, e) {
                    return Ze(n ? i[e] : "", t)
                }) : this._textDesc = Ze(i, t)
            }
            return this._textDesc
        }
        ,
        t.getCenter = function() {
            return this._computeCenter(this._getMeasurer())
        }
        ,
        t.getExtent = function() {
            var t = this._getPrjExtent()
              , e = this._getProjection();
            if (t && e) {
                var i = e.unproject(new Rr(t.xmin,t.ymin))
                  , n = e.unproject(new Rr(t.xmax,t.ymax));
                return new Zr(i,n,e)
            }
            return this._computeExtent(this._getMeasurer())
        }
        ,
        t.getContainerExtent = function(t) {
            var e = this.get2DExtent();
            if (!e || !e.isValid())
                return null;
            var i = this.getMap()
              , n = i.getGLRes()
              , r = this.getMinAltitude()
              , o = e.convertTo(function(t) {
                return i._pointAtResToContainerPoint(t, n, r, na)
            }, t)
              , s = this.getMaxAltitude();
            if (s !== r) {
                var a = e.convertTo(function(t) {
                    return i._pointAtResToContainerPoint(t, n, s, na)
                }, ra);
                o._combine(a)
            }
            var h = this.getLayer();
            if (h && "LineString" === this.type && s && h.options.drawAltitude) {
                var l = e.convertTo(function(t) {
                    return i._pointAtResToContainerPoint(t, n, 0, na)
                }, ra);
                o._combine(l)
            }
            if (o) {
                var u = this._getFixedExtent();
                (function(t) {
                    if (!t)
                        return !1;
                    var e = t.xmin
                      , i = t.ymin
                      , n = t.xmax
                      , r = t.ymax;
                    return 0 < n - e && 0 < r - i
                }
                )(u) && o._add(u)
            }
            return this.options.smoothness && o._expand(.15 * o.getWidth()),
            o
        }
        ,
        t._getFixedExtent = function() {
            this._fixedExtent || (this._fixedExtent = new Vr);
            var t = this._sizeSymbol
              , e = (t && t.lineWidth || 1) / 2;
            this._fixedExtent.set(-e, -e, e, e);
            var i = t && t.lineDx || 0;
            this._fixedExtent._add([i, 0]);
            var n = t && t.lineDy || 0;
            return this._fixedExtent._add([0, n]),
            this._fixedExtent
        }
        ,
        t.get2DExtent = function() {
            var t = this.getMap();
            if (!t)
                return null;
            if (this._extent2d)
                return this._extent2d;
            var e = this._getPrjExtent();
            if (!e || !e.isValid())
                return null;
            var i = e.getMin()
              , n = e.getMax()
              , r = t.getGLRes();
            return t._prjToPointAtRes(i, r, i),
            t._prjToPointAtRes(n, r, n),
            this._extent2d = new Vr(i,n),
            this._extent2d.z = t.getZoom(),
            this._extent2d
        }
        ,
        t.getSize = function() {
            var t = this.getContainerExtent();
            return t ? t.getSize() : null
        }
        ,
        t.containsPoint = function(t, e) {
            if (!this.getMap())
                throw new Error('The geometry is required to be added on a map to perform "containsPoint".');
            return t instanceof Rr && (t = this.getMap().coordToContainerPoint(t)),
            this._containsPoint(t, e)
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this._getPainter();
            return !!i && (e = e || 0,
            this._hitTestTolerance && (e += this._hitTestTolerance()),
            i.hitTest(t, e))
        }
        ,
        t.show = function() {
            if (this.options.visible = !0,
            this.getMap()) {
                var t = this._getPainter();
                t && t.show(),
                this._fireEvent("show")
            }
            return this
        }
        ,
        t.hide = function() {
            if (this.options.visible = !1,
            this.getMap()) {
                this.onHide();
                var t = this._getPainter();
                t && t.hide(),
                this._fireEvent("hide")
            }
            return this
        }
        ,
        t.isVisible = function() {
            if (!this.options.visible)
                return !1;
            var t = this._getInternalSymbol();
            if (!t)
                return !0;
            if (Array.isArray(t)) {
                if (!t.length)
                    return !0;
                for (var e = 0, i = t.length; e < i; e++)
                    if (ut(t[e].opacity) || 0 < t[e].opacity)
                        return !0;
                return !1
            }
            return ut(t.opacity) || _(t.opacity) || G(t.opacity) && 0 < t.opacity
        }
        ,
        t.getZIndex = function() {
            return this.options.zIndex || 0
        }
        ,
        t.setZIndex = function(t) {
            var e = this.options.zIndex;
            return this.options.zIndex = t,
            this._fireEvent("zindexchange", {
                old: e,
                new: t
            }),
            this
        }
        ,
        t.setZIndexSilently = function(t) {
            return this.options.zIndex = t,
            this
        }
        ,
        t.bringToFront = function() {
            var t = this.getLayer();
            if (!t || !t.getGeoMaxZIndex)
                return this;
            var e = t.getGeoMaxZIndex();
            return this.setZIndex(e + 1),
            this
        }
        ,
        t.bringToBack = function() {
            var t = this.getLayer();
            if (!t || !t.getGeoMinZIndex)
                return this;
            var e = t.getGeoMinZIndex();
            return this.setZIndex(e - 1),
            this
        }
        ,
        t.translate = function(t, e) {
            if (ut(t))
                return this;
            var i = new Rr(t,e);
            if (0 === i.x && 0 === i.y)
                return this;
            var n = this.getCoordinates();
            if (this._silence = !0,
            n)
                if (Array.isArray(n)) {
                    var r = wt(n, function(t) {
                        return t.add(i)
                    });
                    this.setCoordinates(r)
                } else
                    this.setCoordinates(n.add(i));
            return this._silence = !1,
            this._fireEvent("positionchange"),
            this
        }
        ,
        t.flash = function(t, e, i, n) {
            return Ht.call(this, t, e, i, n)
        }
        ,
        t.copy = function() {
            var t = this.toJSON()
              , e = i.fromJSON(t);
            return e.options.visible = !0,
            e
        }
        ,
        t.remove = function() {
            return this.getLayer() && (this._fireEvent("removestart"),
            this._unbind(),
            this._fireEvent("removeend"),
            this._fireEvent("remove")),
            this
        }
        ,
        t.toGeoJSONGeometry = function() {
            return this._exportGeoJSONGeometry()
        }
        ,
        t.toGeoJSON = function(t) {
            t || (t = {});
            var e = {
                type: "Feature",
                geometry: null
            };
            if (ut(t.geometry) || t.geometry) {
                var i = this._exportGeoJSONGeometry();
                e.geometry = i
            }
            var n, r = this.getId();
            return ut(r) || (e.id = r),
            (ut(t.properties) || t.properties) && (n = this._exportProperties()),
            e.properties = n,
            e
        }
        ,
        t.toJSON = function(t) {
            t || (t = {});
            var e = this._toJSON(t);
            return F(e, this._exportGraphicOptions(t)),
            e
        }
        ,
        t.getLength = function() {
            return this._computeGeodesicLength(this._getMeasurer())
        }
        ,
        t.getArea = function() {
            return this._computeGeodesicArea(this._getMeasurer())
        }
        ,
        t.rotate = function(e, i) {
            if (!G(e))
                return console.error("angle:" + e + " is not number"),
                this;
            if ("GeometryCollection" === this.type)
                return this.getGeometries().forEach(function(t) {
                    return t.rotate(e, i)
                }),
                this;
            i = i ? new Rr(i) : this.getCenter(),
            this._angle = e,
            this._pivot = i;
            var n = this._getMeasurer()
              , t = this.getCoordinates();
            if (!Array.isArray(t)) {
                if (i.x === t.x && i.y === t.y || this.getShell)
                    this.onPositionChanged();
                else {
                    var r = n._rotate(t, i, e);
                    this.setCoordinates(r)
                }
                return this
            }
            return wt(t, function(t) {
                return n._rotate(t, i, e)
            }),
            this.setCoordinates(t),
            this
        }
        ,
        t._rotatePrjCoordinates = function(t) {
            if (!t || 0 === this._angle || !this._pivot)
                return t;
            var e = this._getProjection();
            if (!e)
                return t;
            var i, n, r = 0, o = Array.isArray(t), s = o ? t : [t], a = [];
            if (this.getRotateOffsetAngle) {
                r = this.getRotateOffsetAngle();
                var h = s[s.length - 1];
                i = h.x,
                n = h.y
            } else {
                var l = Rn();
                On(s, l);
                var u = l[0]
                  , c = l[1];
                i = (u + l[2]) / 2,
                n = (c + l[3]) / 2
            }
            for (var d = 0, f = s.length; d < f; d++) {
                var g = s[d]
                  , p = g.x
                  , m = g.y
                  , _ = p - i
                  , v = m - n
                  , y = Math.sqrt(_ * _ + v * v)
                  , x = (la(i, n, p, m) - this._angle + r) / 180 * Math.PI
                  , w = Math.cos(x) * y
                  , C = Math.sin(x) * y
                  , b = new Rr(i + w,n + C);
                a.push(b)
            }
            for (var P = e.project(this._pivot), M = i - P.x, T = n - P.y, S = 0, E = a.length; S < E; S++) {
                var R = a[S];
                R.x -= M,
                R.y -= T
            }
            return o ? a : a[0]
        }
        ,
        t.isRotated = function() {
            return G(this._angle) && this._pivot
        }
        ,
        t._getConnectPoints = function() {
            return [this.getCenter()]
        }
        ,
        t._initOptions = function(t) {
            var e = F({}, t)
              , i = e.symbol
              , n = e.properties
              , r = e.id;
            delete e.symbol,
            delete e.id,
            delete e.properties,
            this.setOptions(e),
            i && this.setSymbol(i),
            n && this.setProperties(n),
            ut(r) || this.setId(r)
        }
        ,
        t._bindLayer = function(t) {
            if (t !== this.getLayer()) {
                if (this.getLayer())
                    throw new Error("Geometry cannot be added to two or more layers at the same time.");
                this._layer = t,
                this._clearCache(),
                this._bindInfoWindow(),
                this._bindMenu()
            }
        }
        ,
        t._prepareSymbol = function(t) {
            if (Array.isArray(t)) {
                for (var e = [], i = 0; i < t.length; i++)
                    e.push(Ae(this._checkAndCopySymbol(t[i])));
                return e
            }
            return t ? Ae(t = this._checkAndCopySymbol(t)) : null
        }
        ,
        t._checkAndCopySymbol = function(t) {
            var e = {};
            for (var i in t)
                r[i] && P(t[i]) ? e[i] = +t[i] : e[i] = t[i];
            return e
        }
        ,
        t._getSymbol = function() {
            return this._symbol
        }
        ,
        t._setExternSymbol = function(t) {
            return this._eventSymbolProperties = t,
            this._symbol || delete this._textDesc,
            this._externSymbol = this._prepareSymbol(t),
            this.onSymbolChanged(),
            this
        }
        ,
        t._getInternalSymbol = function() {
            return this._symbol ? this._symbol : this._externSymbol ? this._externSymbol : this.options.symbol ? this.options.symbol : null
        }
        ,
        t._getPrjExtent = function() {
            var t = this._getProjection();
            return this._verifyProjection(),
            !this._extent && t && (this._extent = this._computePrjExtent(t)),
            this._extent
        }
        ,
        t._unbind = function() {
            var t = this.getLayer();
            t && (this._animPlayer && this._animPlayer.finish(),
            this._unbindMenu(),
            this._unbindInfoWindow(),
            this.isEditing() && this.endEdit(),
            this._removePainter(),
            this.onRemove && this.onRemove(),
            t.onRemoveGeometry && t.onRemoveGeometry(this),
            delete this._layer,
            delete this._internalId,
            delete this._extent)
        }
        ,
        t._getInternalId = function() {
            return this._internalId
        }
        ,
        t._setInternalId = function(t) {
            this._internalId = t
        }
        ,
        t._getMeasurer = function() {
            return this._getProjection() ? this._getProjection() : ia.getProjectionInstance(this.options.defaultProjection)
        }
        ,
        t._getProjection = function() {
            var t = this.getMap();
            return t ? t.getProjection() : null
        }
        ,
        t._verifyProjection = function() {
            var t = this._getProjection();
            this._projCode && t && this._projCode !== t.code && this._clearProjection(),
            this._projCode = t ? t.code : this._projCode
        }
        ,
        t._getExternalResources = function() {
            return Re(this._getInternalSymbol())
        }
        ,
        t._getPainter = function() {
            if (this._painter)
                return this._painter;
            var t = this.getLayer();
            if (!this._painter && t)
                if (-1 !== n.indexOf(this.type)) {
                    if (t.constructor.getCollectionPainterClass) {
                        var e = t.constructor.getCollectionPainterClass();
                        e && (this._painter = new e(this))
                    }
                } else if (t.constructor.getPainterClass) {
                    var i = t.constructor.getPainterClass();
                    i && (this._painter = new i(this))
                }
            return this._painter
        }
        ,
        t._getMaskPainter = function() {
            return this._maskPainter || (this._maskPainter = this.getGeometries && this.getGeometries() ? new ta(this,!0) : new Ks(this)),
            this._maskPainter
        }
        ,
        t._removePainter = function() {
            this._painter && this._painter.remove(),
            delete this._painter
        }
        ,
        t._paint = function(t) {
            if (this._painter) {
                if (this._dirtyCoords) {
                    delete this._dirtyCoords;
                    var e = this._getProjection();
                    e && (this._pcenter = e.project(this._coordinates),
                    this._clearCache())
                }
                this._painter.paint(t)
            }
        }
        ,
        t._clearCache = function() {
            delete this._extent,
            delete this._extent2d,
            this._clearAltitudeCache()
        }
        ,
        t._clearProjection = function() {
            delete this._extent,
            delete this._extent2d
        }
        ,
        t._repaint = function() {
            this._painter && this._painter.repaint()
        }
        ,
        t.onHide = function() {
            this.closeMenu(),
            this.closeInfoWindow()
        }
        ,
        t.onShapeChanged = function() {
            this._clearCache(),
            this._repaint(),
            this._fireEvent("shapechange")
        }
        ,
        t.onPositionChanged = function() {
            this._clearCache(),
            this._repaint(),
            this._fireEvent("positionchange")
        }
        ,
        t.onSymbolChanged = function() {
            this._painter && this._painter.refreshSymbol();
            var t = {};
            this._eventSymbolProperties ? (t.properties = JSON.parse(JSON.stringify(this._eventSymbolProperties)),
            delete this._eventSymbolProperties) : delete this._textDesc,
            this._genSizeSymbol(),
            this._fireEvent("symbolchange", t)
        }
        ,
        t._genSizeSymbol = function() {
            var t = this._getInternalSymbol();
            if (t)
                if (Array.isArray(t)) {
                    for (var e = !(this._sizeSymbol = []), i = 0; i < t.length; i++) {
                        var n = this._sizeSymbol[i] = this._getSizeSymbol(t[i]);
                        !e && n && n._dynamic && (e = !0)
                    }
                    this._sizeSymbol._dynamic = e
                } else
                    this._sizeSymbol = this._getSizeSymbol(t);
            else
                delete this._sizeSymbol
        }
        ,
        t._getSizeSymbol = function(t) {
            var e = Me({
                lineWidth: t.lineWidth,
                lineDx: t.lineDx,
                lineDy: t.lineDy
            }, this);
            return (ne(t.lineWidth) || ne(t.lineDx) || ne(t.lineDy)) && (e._dynamic = !0),
            e
        }
        ,
        t._getCompiledSymbol = function() {
            return this._compiledSymbol || (this._compiledSymbol = Me(this._getInternalSymbol(), this)),
            this._compiledSymbol
        }
        ,
        t.onConfig = function(t) {
            var e;
            t.properties && (e = t.properties,
            delete t.properties);
            var i = !1;
            for (var n in t)
                if (t.hasOwnProperty(n)) {
                    var r = n.slice(0, 5);
                    if ("arrow" === r || "smoot" === r) {
                        i = !0;
                        break
                    }
                }
            e ? (this.setProperties(e),
            this._repaint()) : i && this._repaint()
        }
        ,
        t._setParent = function(t) {
            t && (this._parent = t)
        }
        ,
        t._getParent = function() {
            return this._parent
        }
        ,
        t._fireEvent = function(t, e) {
            this._silence || (this.getLayer() && this.getLayer()._onGeometryEvent && (e || (e = {}),
            e.type = t,
            (e.target = this).getLayer()._onGeometryEvent(e)),
            this.fire(t, e))
        }
        ,
        t._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t)
            }
        }
        ,
        t._exportGraphicOptions = function(t) {
            var e = {};
            return (ut(t.options) || t.options) && (e.options = this.config()),
            (ut(t.symbol) || t.symbol) && (e.symbol = this.getSymbol()),
            (ut(t.infoWindow) || t.infoWindow) && this._infoWinOptions && (e.infoWindow = this._infoWinOptions),
            e
        }
        ,
        t._exportGeoJSONGeometry = function() {
            var t = this.getCoordinates()
              , e = Rr.toNumberArrays(t);
            return {
                type: this.getType(),
                coordinates: e
            }
        }
        ,
        t._exportProperties = function() {
            var t = null
              , e = this.getProperties();
            return ut(e) || (t = _(e) ? F({}, e) : e),
            t
        }
        ,
        t._hitTestTolerance = function() {
            return 0
        }
        ,
        t._getAltitude = function() {
            var t = this.getLayer();
            if (!t)
                return 0;
            var e = t.options
              , i = t.getAltitude ? t.getAltitude() : 0
              , n = e.enableAltitude;
            if (!n)
                return i;
            var r = aa(t)
              , o = (this.properties || oa)[r];
            if (ut(o)) {
                var s = ha(this, i, n);
                return ut(s) ? i : s
            }
            return Array.isArray(o) ? o.map(function(t) {
                return t + i
            }) : o + i
        }
        ,
        t.getAltitude = function() {
            var t = aa(this.getLayer())
              , e = (this.properties || oa)[t];
            if (!ut(e))
                return e;
            var i = ha(this, 0, !1);
            return ut(i) ? 0 : i
        }
        ,
        t.hasAltitude = function() {
            return !!this._getAltitude()
        }
        ,
        t.setAltitude = function(t) {
            if (!G(t))
                return this;
            var e = this.getLayer()
              , i = aa(e)
              , n = this.properties || oa
              , r = n[i];
            if (!ut(r))
                if (Array.isArray(r))
                    for (var o = 0, s = r.length; o < s; o++)
                        r[o] = t;
                else
                    n[i] = t;
            var a = this.getCoordinates ? this.getCoordinates() : null;
            if (!a)
                return this;
            if (function t(e, i) {
                if (Array.isArray(e))
                    for (var n = 0, r = e.length; n < r; n++)
                        t(e[n], i);
                else
                    e.z = i
            }(a, t),
            e) {
                var h = e.getRenderer();
                h && h.gl ? this.setCoordinates(a) : h && this._repaint()
            }
            return this._clearAltitudeCache(),
            this
        }
        ,
        t._genMinMaxAlt = function() {
            var i = this
              , t = this._getAltitude();
            Array.isArray(t) ? (this._minAlt = Number.MAX_VALUE,
            this._maxAlt = Number.MIN_VALUE,
            t.forEach(function(t) {
                var e = t;
                e < i._minAlt && (i._minAlt = e),
                e > i._maxAlt && (i._maxAlt = e)
            })) : this._minAlt = this._maxAlt = t
        }
        ,
        t.getMinAltitude = function() {
            return void 0 === this._minAlt && this._genMinMaxAlt(),
            this._minAlt ? this._minAlt : 0
        }
        ,
        t.getMaxAltitude = function() {
            return void 0 === this._maxAlt && this._genMinMaxAlt(),
            this._maxAlt ? this._maxAlt : 0
        }
        ,
        t._clearAltitudeCache = function() {
            return this._minAlt = void 0,
            this._maxAlt = void 0,
            this
        }
        ,
        i
    }(or(Un(Pr(qn))));
    function aa(t) {
        var e = "altitude";
        t && (e = t.options.altitudeProperty);
        return e
    }
    function ha(t, e, i) {
        var n = t.getCoordinates ? t.getCoordinates() : null;
        if (n) {
            var r = [];
            if (function t(e, i) {
                if (i.length)
                    return;
                if (Array.isArray(e))
                    for (var n = 0, r = e.length; n < r; n++)
                        t(e[n], i);
                else
                    G(e.z) && i.push(e.z)
            }(n, r),
            r.length)
                return function t(e, i, n) {
                    if (Array.isArray(e)) {
                        for (var r = [], o = 0, s = e.length; o < s; o++)
                            r.push(t(e[o], i, n));
                        return r
                    }
                    return G(e.z) ? n ? i + e.z : e.z : n ? i : 0
                }(n, e, i)
        }
        return null
    }
    function la(t, e, i, n) {
        return t === i ? e < n ? -90 : 90 : (i -= t,
        n = -(n -= e),
        Math.atan2(n, i) / Math.PI * 180)
    }
    sa.mergeOptions({
        id: null,
        visible: !0,
        interactive: !0,
        editable: !0,
        cursor: null,
        antiMeridian: !1,
        defaultProjection: "EPSG:4326"
    });
    var ua = {
        attribution: null,
        minZoom: null,
        maxZoom: null,
        visible: !0,
        opacity: 1,
        globalCompositeOperation: null,
        renderer: "canvas",
        debugOutline: "#0f0",
        cssFilter: null,
        forceRenderOnMoving: !1,
        forceRenderOnZooming: !1,
        forceRenderOnRotating: !1,
        collision: !1,
        collisionScope: "layer",
        hitDetect: !$.mobile
    }
      , ca = function(r) {
        function t(t, e) {
            var i, n;
            return e && (n = e.canvas,
            delete e.canvas),
            (i = r.call(this, e) || this)._canvas = n,
            i.setId(t),
            e && (i.setZIndex(e.zIndex),
            e.mask && i.setMask(sa.fromJSON(e.mask))),
            i.proxyOptions(),
            i
        }
        it(t, r);
        var e = t.prototype;
        return e.load = function() {
            if (!this.getMap())
                return this;
            if (this.onLoad()) {
                this._initRenderer();
                var t = this.getZIndex();
                ut(t) || (this._renderer.setZIndex(t),
                this.isCanvasRender() || this._renderer.render()),
                this.onLoadEnd()
            }
            return this
        }
        ,
        e.getId = function() {
            return this._id
        }
        ,
        e.setId = function(t) {
            var e = this._id;
            return ut(t) || (t += ""),
            this._id = t,
            this.fire("idchange", {
                old: e,
                new: t
            }),
            this
        }
        ,
        e.addTo = function(t) {
            return t.addLayer(this),
            this
        }
        ,
        e.setZIndex = function(t) {
            return ut(this._zIndex = t) ? delete this.options.zIndex : this.options.zIndex = t,
            this.map && this.map._sortLayersByZIndex(),
            this._renderer && this._renderer.setZIndex(t),
            this.fire("setzindex", {
                zIndex: t
            }),
            this
        }
        ,
        e.getZIndex = function() {
            return this._zIndex || 0
        }
        ,
        e.getMinZoom = function() {
            var t = this.getMap()
              , e = this.options.minZoom;
            return t ? Math.max(t.getMinZoom(), e || 0) : e
        }
        ,
        e.getMaxZoom = function() {
            var t = this.getMap()
              , e = this.options.maxZoom;
            return t ? Math.min(t.getMaxZoom(), ut(e) ? 1 / 0 : e) : e
        }
        ,
        e.getOpacity = function() {
            return this.options.opacity
        }
        ,
        e.setOpacity = function(t) {
            return this.config("opacity", t),
            this.fire("setopacity", {
                opacity: t
            }),
            this
        }
        ,
        e.isCanvasRender = function() {
            var t = this._getRenderer();
            return t && t instanceof Io
        }
        ,
        e.getMap = function() {
            return this.map ? this.map : null
        }
        ,
        e.getProjection = function() {
            var t = this.getMap();
            return t ? t.getProjection() : null
        }
        ,
        e.bringToFront = function() {
            var t = this._getLayerList();
            if (!t.length)
                return this;
            var e = t[t.length - 1];
            if (1 === t.length || e === this)
                return this;
            var i = e.getZIndex();
            return this.setZIndex(i + 1),
            this
        }
        ,
        e.bringToBack = function() {
            var t = this._getLayerList();
            if (!t.length)
                return this;
            var e = t[0];
            if (1 === t.length || e === this)
                return this;
            var i = e.getZIndex();
            return this.setZIndex(i - 1),
            this
        }
        ,
        e.show = function() {
            var t = this;
            if (!this.options.visible) {
                this.options.visible = !0;
                var e = this.getRenderer();
                e && e.show();
                var i = this.getMap();
                e && i ? i.once("renderend", function() {
                    t.fire("show")
                }) : this.fire("show")
            }
            return this
        }
        ,
        e.hide = function() {
            var t = this;
            if (this.options.visible) {
                this.options.visible = !1;
                var e = this.getRenderer();
                e && e.hide();
                var i = this.getMap();
                e && i ? i.once("renderend", function() {
                    t.fire("hide")
                }) : this.fire("hide")
            }
            return this
        }
        ,
        e.isVisible = function() {
            if (G(this.options.opacity) && this.options.opacity <= 0)
                return !1;
            var t = this.getMap();
            if (t) {
                var e = t.getZoom();
                if (!ut(this.options.maxZoom) && this.options.maxZoom < e || !ut(this.options.minZoom) && this.options.minZoom > e)
                    return !1
            }
            return ut(this.options.visible) && (this.options.visible = !0),
            this.options.visible
        }
        ,
        e.remove = function() {
            if (this.map) {
                var t = this.map.getRenderer();
                this.map.removeLayer(this),
                t && t.setToRedraw()
            } else
                this.fire("remove");
            return this
        }
        ,
        e.getMask = function() {
            return this._mask
        }
        ,
        e.setMask = function(t) {
            if (!("Point" === t.type && t._isVectorMarker() || "Polygon" === t.type || "MultiPolygon" === t.type))
                throw new Error("Mask for a layer must be a marker with vector marker symbol or a Polygon(MultiPolygon).");
            if (t._bindLayer(this),
            "Point" === t.type ? t.updateSymbol({
                markerLineColor: "rgba(0, 0, 0, 0)",
                markerFillOpacity: 0
            }) : t.setSymbol({
                lineColor: "rgba(0, 0, 0, 0)",
                polygonOpacity: 0
            }),
            this._mask = t,
            this.options.mask = t.toJSON(),
            !this.getMap() || this.getMap().isZooming())
                return this;
            var e = this._getRenderer();
            return e && e.setToRedraw && this._getRenderer().setToRedraw(),
            this
        }
        ,
        e.removeMask = function() {
            if (delete this._mask,
            delete this.options.mask,
            !this.getMap() || this.getMap().isZooming())
                return this;
            var t = this._getRenderer();
            return t && t.setToRedraw && this._getRenderer().setToRedraw(),
            this
        }
        ,
        e.onLoad = function() {
            return !0
        }
        ,
        e.onLoadEnd = function() {}
        ,
        e.isLoaded = function() {
            return !!this._loaded
        }
        ,
        e.getCollisionIndex = function() {
            if ("layer" === this.options.collisionScope)
                return this._collisionIndex || (this._collisionIndex = new br),
                this._collisionIndex;
            var t = this.getMap();
            return t ? t.getCollisionIndex() : null
        }
        ,
        e.clearCollisionIndex = function() {
            return "layer" === this.options.collisionScope && this._collisionIndex && this._collisionIndex.clear(),
            this
        }
        ,
        e.getRenderer = function() {
            return this._getRenderer()
        }
        ,
        e.onConfig = function(t) {
            if (t && Object.keys && 0 < Object.keys(t).length && ut(t.animation)) {
                if (this._optionsHook && H(this._optionsHook) && this._optionsHook(t),
                this._silentConfig)
                    return;
                var e = this.getRenderer();
                e && e.setToRedraw && e.setToRedraw()
            }
        }
        ,
        e.onAdd = function() {}
        ,
        e.onRendererCreate = function() {}
        ,
        e.onCanvasCreate = function() {}
        ,
        e.onRemove = function() {}
        ,
        e._bindMap = function(t, e) {
            t && (this.map = t,
            ut(e) || this.setZIndex(e),
            this._switchEvents("on", this),
            this.onAdd(),
            this.fire("add"))
        }
        ,
        e._initRenderer = function() {
            var t = this.options.renderer;
            if (this.constructor.getRendererClass) {
                var e = this.constructor.getRendererClass(t);
                if (!e)
                    throw new Error("Invalid renderer for Layer(" + this.getId() + "):" + t);
                this._renderer = new e(this),
                (this._renderer.layer = this)._renderer.setZIndex(this.getZIndex()),
                this._switchEvents("on", this._renderer),
                this._renderer.onAdd && this._renderer.onAdd(),
                this.onRendererCreate(),
                this.fire("renderercreate", {
                    renderer: this._renderer
                })
            }
        }
        ,
        e._doRemove = function() {
            this._loaded = !1,
            this._switchEvents("off", this),
            this.onRemove(),
            this._renderer && (this._switchEvents("off", this._renderer),
            this._renderer.remove(),
            delete this._renderer),
            delete this.map,
            delete this._collisionIndex
        }
        ,
        e._switchEvents = function(t, e) {
            e && e.getEvents && this.getMap() && this.getMap()[t](e.getEvents(), e)
        }
        ,
        e._getRenderer = function() {
            return this._renderer
        }
        ,
        e._getLayerList = function() {
            return this.map ? this.map._layers : []
        }
        ,
        e._getMask2DExtent = function() {
            if (!this._mask || !this.getMap())
                return null;
            var t = this._mask._getMaskPainter();
            return t ? t.get2DExtent() : null
        }
        ,
        t
    }(or(Un(Ro(qn))));
    ca.mergeOptions(ua);
    var da = ca.prototype.fire;
    ca.prototype.fire = function(t, e) {
        return "layerload" === t && (this._loaded = !0),
        this.map && (e || (e = {}),
        e.type = t,
        (e.target = this).map._onLayerEvent(e)),
        da.apply(this, arguments),
        -1 < ["show", "hide"].indexOf(t) && this.fire("visiblechange", Object.assign({}, e, {
            visible: this.options.visible
        })),
        this
    }
    ;
    var fa, ga, pa, ma, _a, va, ya, xa, wa, Ca, ba, Pa, Ma, Ta, Sa, Ea, Ra, Aa, ka, Oa, La, Da, Ia, za, ja, Fa, Ga, Ha, Ba, Na, Za, Wa, Va, Ua, Ja = new Rr(0,0), qa = new dt(0,0), Xa = ["centerCross", "fog", "fogColor", "debugSky"], Ya = {
        maxVisualPitch: 70,
        maxPitch: 80,
        centerCross: !1,
        zoomInCenter: !1,
        zoomOrigin: null,
        zoomAnimation: !f,
        zoomAnimationDuration: 330,
        panAnimation: !f,
        panAnimationDuration: 600,
        rotateAnimation: !f,
        zoomable: !0,
        enableInfoWindow: !0,
        hitDetect: !$.mobile,
        hitDetectLimit: 5,
        fpsOnInteracting: 25,
        layerCanvasLimitOnInteracting: -1,
        maxZoom: null,
        minZoom: null,
        maxExtent: null,
        fixCenterOnResize: !0,
        checkSize: !0,
        checkSizeInterval: 1e3,
        renderer: "canvas",
        cascadePitches: [10, 60],
        renderable: !0,
        clickTimeThreshold: 280,
        stopRenderOnOffscreen: !0,
        preventWheelScroll: !0,
        preventTouch: !0,
        supportPluginEvent: !0,
        switchDragButton: !1,
        mousemoveThrottleTime: 48
    }, Qa = function(h) {
        function l(t, e) {
            var i;
            if (!e)
                throw new Error("Invalid options when creating map.");
            if (!e.center)
                throw new Error("Invalid center when creating map.");
            var n = F({}, e)
              , r = n.zoom;
            delete n.zoom;
            var o = new Rr(n.center);
            delete n.center;
            var s = n.baseLayer;
            delete n.baseLayer;
            var a = n.layers;
            return delete n.layers,
            (i = h.call(this, n) || this).VERSION = l.VERSION,
            Object.defineProperty(at(at(i)), "id", {
                value: mt(),
                writable: !1
            }),
            i._loaded = !1,
            i._initContainer(t),
            i._panels = {},
            i._baseLayer = null,
            i._layers = [],
            i._zoomLevel = r,
            i._center = o,
            i._centerZ = o.z,
            i.setSpatialReference(n.spatialReference || n.view),
            i._mapViewPoint = new dt(0,0),
            i._initRenderer(),
            i._updateMapSize(i._getContainerDomSize()),
            s && i.setBaseLayer(s),
            a && i.addLayer(a),
            i.setMaxExtent(n.maxExtent),
            i._Load(),
            i.proxyOptions(),
            i.isMap = !0,
            i
        }
        it(l, h),
        l.addOnLoadHook = function(t) {
            var e = Array.prototype.slice.call(arguments, 1)
              , i = "function" == typeof t ? t : function() {
                this[t].apply(this, e)
            }
            ;
            return this.prototype._onLoadHooks = this.prototype._onLoadHooks || [],
            this.prototype._onLoadHooks.push(i),
            this
        }
        ;
        var t = l.prototype;
        return t.isLoaded = function() {
            return !!this._loaded
        }
        ,
        t.getContainer = function() {
            return this._containerDOM
        }
        ,
        t.getSpatialReference = function() {
            return this._spatialReference
        }
        ,
        t.setSpatialReference = function(t) {
            var e = this.options.spatialReference;
            return this._loaded && ia.equals(e, t) || this._updateSpatialReference(t, e),
            this
        }
        ,
        t._updateSpatialReference = function(t, e) {
            P(t) && (t = ia.getPreset(t)),
            t = F({}, t),
            this._center = this.getCenter(),
            this.options.spatialReference = t,
            this._spatialReference = new ia(t);
            var i = this._spatialReference.getProjection();
            return this.options.spatialReference && H(this.options.spatialReference.projection) && (this.options.spatialReference.projection = i.code),
            this._resetMapStatus(),
            bo.is(i.code) && (this._originLng = i.centralMeridian,
            this._altitudeOriginDirty = !0),
            this._fireEvent("spatialreferencechange", {
                old: e,
                new: F({}, this.options.spatialReference)
            }),
            this
        }
        ,
        t.onConfig = function(t) {
            var e = t.spatialReference || t.view;
            ut(e) || this._updateSpatialReference(e, null);
            for (var i = !1, n = 0, r = Xa.length; n < r; n++) {
                if (!ut(t[Xa[n]])) {
                    i = !0;
                    break
                }
            }
            if (!i)
                return this;
            var o = this.getRenderer();
            return o && o.setToRedraw(),
            this
        }
        ,
        t.getProjection = function() {
            return this._spatialReference ? this._spatialReference.getProjection() : null
        }
        ,
        t.getFullExtent = function() {
            return this._spatialReference ? this._spatialReference.getFullExtent() : null
        }
        ,
        t.setCursor = function(t) {
            return delete this._cursor,
            this._trySetCursor(t),
            this._cursor = t,
            this
        }
        ,
        t.resetCursor = function() {
            return this.setCursor(null)
        }
        ,
        t.getCenter = function() {
            if (!this._loaded || !this._prjCenter)
                return this._center;
            var t = this.getProjection().unproject(this._prjCenter);
            return t.x = Math.round(1e8 * t.x) / 1e8,
            t.y = Math.round(1e8 * t.y) / 1e8,
            t.z = this._centerZ,
            this.centerAltitude && (t.z = this.centerAltitude),
            t
        }
        ,
        t.setCenter = function(t, e) {
            if (!t)
                return this;
            t = new Rr(t),
            e && (t = this._getCenterByPadding(t, this.getZoom(), e));
            var i = this.getProjection().project(t);
            return this._verifyExtent(i) && (this._loaded ? (this._centerZ = t.z || 0,
            this.onMoveStart(),
            this._setPrjCenter(i),
            this.onMoveEnd(this._parseEventFromCoord(this.getCenter()))) : this._center = t),
            this
        }
        ,
        t.getSize = function() {
            return ut(this.width) || ut(this.height) ? this._getContainerDomSize() : new Oe(this.width,this.height)
        }
        ,
        t.getContainerExtent = function() {
            var t = this.height
              , e = this.getPitch()
              , i = this.options.maxVisualPitch;
            return i && i < e && (t = this._getVisualHeight(i)),
            new Vr(0,this.height - t,this.width,this.height)
        }
        ,
        t._getVisualHeight = function(t) {
            t = t || .01;
            var e = (90 - this.getPitch()) * Math.PI / 180
              , i = this.getFov() * Math.PI / 180;
            t *= Math.PI / 180;
            var n = this.cameraCenterDistance / this.getGLScale()
              , r = Math.tan(i / 2)
              , o = n * r / (1 / Math.tan(t) - r) / Math.sin(t)
              , s = n * (Math.sin(e) * o / (n + Math.cos(e) * o));
            return this.height / 2 + s
        }
        ,
        t.getExtent = function() {
            return this._pointToExtent(this._get2DExtent())
        }
        ,
        t.getProjExtent = function() {
            var t = this._get2DExtent();
            return new Zr(this._pointToPrj(t.getMin()),this._pointToPrj(t.getMax()))
        }
        ,
        t.getPrjExtent = function() {
            return this.getProjExtent()
        }
        ,
        t.getMaxExtent = function() {
            return this.options.maxExtent ? new Zr(this.options.maxExtent,this.getProjection()) : null
        }
        ,
        t.setMaxExtent = function(t) {
            if (t) {
                var e = new Zr(t,this.getProjection());
                this.options.maxExtent = e;
                var i = this.getProjection();
                this._prjMaxExtent = e.convertTo(function(t) {
                    return i.project(t)
                }),
                this._verifyExtent(this._getPrjCenter()) || (this._loaded ? this._panTo(this._prjMaxExtent.getCenter()) : this._center = i.unproject(this._prjMaxExtent.getCenter()))
            } else
                delete this.options.maxExtent,
                delete this._prjMaxExtent;
            return this
        }
        ,
        t.getZoom = function() {
            return this._zoomLevel
        }
        ,
        t.getZoomForScale = function(t, e, i) {
            var n = this.getZoom();
            if (ut(e) && (e = n),
            1 === t && e === n)
                return n;
            var r = this._getResolution(e) / t
              , o = this.getZoomFromRes(r);
            if (i)
                return o;
            return this.getSpatialReference().getZoomDirection() < 0 ? Math.ceil(o - 1e-6) : Math.floor(o + 1e-6)
        }
        ,
        t.getZoomFromRes = function(t) {
            var e = this._getResolutions()
              , i = this._getResolution(this.getMinZoom())
              , n = this._getResolution(this.getMaxZoom());
            if (i <= n) {
                if (t <= i)
                    return this.getMinZoom();
                if (n <= t)
                    return this.getMaxZoom()
            } else {
                if (i <= t)
                    return this.getMinZoom();
                if (t <= n)
                    return this.getMaxZoom()
            }
            for (var r = e.length, o = 0; o < r - 1; o++)
                if (e[o]) {
                    var s = e[o + 1] - e[o]
                      , a = t - e[o];
                    if (bt(s) === bt(a) && Math.abs(s) >= Math.abs(a))
                        return o + a / s
                }
            return r - 1
        }
        ,
        t.setZoom = function(t, e) {
            return void 0 === e && (e = {
                animation: !0
            }),
            isNaN(t) || ut(t) || (t = +t,
            this._loaded && this.options.zoomAnimation && e.animation ? this._zoomAnimation(t) : this._zoom(t)),
            this
        }
        ,
        t.getMaxZoom = function() {
            return ut(this.options.maxZoom) ? this.getMaxNativeZoom() : this.options.maxZoom
        }
        ,
        t.setMaxZoom = function(t) {
            var e = this.getMaxNativeZoom();
            return e < t && (t = e),
            null !== t && t < this._zoomLevel && (this.setZoom(t),
            t = +t),
            this.options.maxZoom = t,
            this
        }
        ,
        t.getMinZoom = function() {
            return ut(this.options.minZoom) ? this._spatialReference.getMinZoom() : this.options.minZoom
        }
        ,
        t.setMinZoom = function(t) {
            if (null !== t) {
                t = +t;
                var e = this._spatialReference.getMinZoom();
                t < e && (t = e),
                t > this._zoomLevel && this.setZoom(t)
            }
            return this.options.minZoom = t,
            this
        }
        ,
        t.getMaxNativeZoom = function() {
            var t = this.getSpatialReference();
            return t ? t.getMaxZoom() : null
        }
        ,
        t.getGLRes = function() {
            if (this._glRes)
                return this._glRes;
            var t = this.getSpatialReference().getFullExtent();
            return this._glRes = (t.right - t.left) / Math.pow(2, 19),
            this._glRes
        }
        ,
        t.getGLScale = function(t) {
            return ut(t) && (t = this.getZoom()),
            this._getResolution(t) / this.getGLRes()
        }
        ,
        t.zoomIn = function() {
            return this.setZoom(this.getZoom() + 1)
        }
        ,
        t.zoomOut = function() {
            return this.setZoom(this.getZoom() - 1)
        }
        ,
        t.isZooming = function() {
            return !!this._zooming
        }
        ,
        t.isInteracting = function() {
            return this.isZooming() || this.isMoving() || this.isRotating()
        }
        ,
        t.setCenterAndZoom = function(t, e) {
            return ut(e) || this._zoomLevel === e ? this.setCenter(t) : (this.setCenter(t),
            this.setZoom(e, {
                animation: !1
            })),
            this
        }
        ,
        t._getPaddingSize = function(t) {
            return void 0 === t && (t = {}),
            t.paddingLeft || t.paddingTop || t.paddingRight || t.paddingBottom ? {
                width: (t.paddingLeft || 0) + (t.paddingRight || 0),
                height: (t.paddingTop || 0) + (t.paddingBottom || 0)
            } : null
        }
        ,
        t.getFitZoom = function(t, e, i) {
            var n = this;
            if (!(t && t instanceof Zr))
                return this._zoomLevel;
            if (t.xmin === t.xmax && t.ymin === t.ymax)
                return this.getMaxZoom();
            var r = this.getSize()
              , o = this._getPaddingSize(i);
            o && (r = {
                width: r.width - (o.width || 0),
                height: r.height - (o.height || 0)
            });
            var s = t.convertTo(function(t) {
                return n.coordToPoint(t)
            })
              , a = s.getWidth()
              , h = s.getHeight()
              , l = r.width / a
              , u = r.height / h
              , c = this.getSpatialReference().getZoomDirection() < 0 ? Math.max(l, u) : Math.min(l, u);
            return this.getZoomForScale(c, null, e)
        }
        ,
        t.getView = function() {
            return {
                center: this.getCenter().toArray(),
                zoom: this.getZoom(),
                pitch: this.getPitch(),
                bearing: this.getBearing()
            }
        }
        ,
        t.setView = function(t) {
            return t && (t.center && this.setCenter(t.center),
            null === t.zoom || isNaN(+t.zoom) || this.setZoom(+t.zoom, {
                animation: !1
            }),
            null === t.pitch || isNaN(+t.pitch) || this.setPitch(+t.pitch),
            null === t.pitch || isNaN(+t.bearing) || this.setBearing(+t.bearing)),
            this
        }
        ,
        t.getResolution = function(t) {
            return this._getResolution(t)
        }
        ,
        t.getScale = function(t) {
            var e = ut(t) ? this.getZoom() : t
              , i = this._getResolution(this.getMaxNativeZoom());
            return this._getResolution(e) / i
        }
        ,
        t._getCenterByPadding = function(t, e, i) {
            void 0 === i && (i = {});
            var n = this.coordinateToPoint(t, e)
              , r = i
              , o = r.paddingLeft
              , s = void 0 === o ? 0 : o
              , a = r.paddingRight
              , h = void 0 === a ? 0 : a
              , l = r.paddingTop
              , u = void 0 === l ? 0 : l
              , c = r.paddingBottom
              , d = void 0 === c ? 0 : c
              , f = 0
              , g = 0;
            (s || h) && (f = (h - s) / 2),
            (u || d) && (g = (u - d) / 2);
            var p = new dt({
                x: n.x + f,
                y: n.y + g
            });
            return this.pointToCoordinate(p, e)
        }
        ,
        t.fitExtent = function(t, e, i, n) {
            if (void 0 === i && (i = {}),
            !t)
                return this;
            t = new Zr(t,this.getProjection());
            var r = this.getFitZoom(t, i.isFraction || !1, i) + (e || 0)
              , o = t.getCenter();
            return this._getPaddingSize(i) && (o = this._getCenterByPadding(o, r, i)),
            void 0 === i.animation || i.animation ? this._animateTo({
                center: o,
                zoom: r
            }, {
                duration: i.duration || this.options.zoomAnimationDuration,
                easing: i.easing || "out"
            }, n) : this.setCenterAndZoom(o, r)
        }
        ,
        t.getBaseLayer = function() {
            return this._baseLayer
        }
        ,
        t.setBaseLayer = function(t) {
            var e = !1;
            if (this._baseLayer && (e = !0,
            this._fireEvent("baselayerchangestart"),
            this._baseLayer.remove()),
            !t)
                return delete this._baseLayer,
                this._fireEvent("baselayerchangeend"),
                this._fireEvent("setbaselayer"),
                this;
            return (this._baseLayer = t)._bindMap(this, -1),
            this._baseLayer.on("layerload", function() {
                this._fireEvent("baselayerload"),
                e && (e = !1,
                this._fireEvent("baselayerchangeend"))
            }, this),
            this._loaded && this._baseLayer.load(),
            this._fireEvent("setbaselayer"),
            this
        }
        ,
        t.removeBaseLayer = function() {
            return this._baseLayer && (this._baseLayer.remove(),
            delete this._baseLayer,
            this._fireEvent("baselayerremove")),
            this
        }
        ,
        t.getLayers = function(e) {
            return this._getLayers(function(t) {
                return !(t === this._baseLayer || 0 <= t.getId().indexOf(g)) && (!e || e(t))
            })
        }
        ,
        t.getLayer = function(t) {
            if (!t)
                return null;
            var e = this._layerCache ? this._layerCache[t] : null;
            if (e)
                return e;
            var i = this.getBaseLayer();
            return i && i.getId() === t ? i : null
        }
        ,
        t.addLayer = function(t) {
            if (!t)
                return this;
            if (!Array.isArray(t))
                return t = Array.prototype.slice.call(arguments, 0),
                this.addLayer(t);
            this._layerCache || (this._layerCache = {});
            for (var e = this._layers, i = 0, n = t.length; i < n; i++) {
                var r = t[i]
                  , o = r.getId();
                if (ut(o))
                    throw new Error("Invalid id for the layer: " + o);
                if (r.getMap() !== this) {
                    if (this._layerCache[o])
                        throw new Error("Duplicate layer id in the map: " + o);
                    (this._layerCache[o] = r)._bindMap(this),
                    e.push(r),
                    this._loaded && r.load()
                }
            }
            return this._sortLayersByZIndex(),
            this._fireEvent("addlayer", {
                layers: t
            }),
            this
        }
        ,
        t.removeLayer = function(t) {
            if (!t)
                return this;
            if (!Array.isArray(t))
                return this.removeLayer([t]);
            for (var e = [], i = 0, n = t.length; i < n; i++) {
                var r = t[i];
                if (r instanceof ca || (r = this.getLayer(r)),
                r) {
                    var o = r.getMap();
                    if (o && o === this) {
                        e.push(r),
                        this._removeLayer(r, this._layers),
                        this._loaded && r._doRemove();
                        var s = r.getId();
                        this._layerCache && delete this._layerCache[s]
                    }
                }
            }
            if (0 < e.length) {
                var a = this.getRenderer();
                a && a.setLayerCanvasUpdated(),
                this.once("frameend", function() {
                    e.forEach(function(t) {
                        t.fire("remove")
                    })
                })
            }
            return this._fireEvent("removelayer", {
                layers: t
            }),
            this
        }
        ,
        t.sortLayers = function(t) {
            if (!t || !Array.isArray(t))
                return this;
            for (var e = [], i = Number.MAX_VALUE, n = 0, r = t.length; n < r; n++) {
                var o = t[n];
                if (P(t[n]) && (o = this.getLayer(o)),
                !(o instanceof ca && o.getMap() && o.getMap() === this))
                    throw new Error("It must be a layer added to this map to order.");
                o.getZIndex() < i && (i = o.getZIndex()),
                e.push(o)
            }
            for (var s = 0, a = e.length; s < a; s++)
                e[s].setZIndex(i + s);
            return this
        }
        ,
        t.toDataURL = function(t) {
            t || (t = {});
            var e = t.mimeType;
            e || (e = "image/png");
            var i = t.save
              , n = this._getRenderer();
            if (n && n.toDataURL) {
                var r = t.fileName;
                r || (r = "export");
                var o = n.toDataURL(e, t.quality || .92);
                if (i && o) {
                    var s;
                    if ("undefined" != typeof Blob && "undefined" != typeof atob) {
                        var a = It(o.replace(/^data:image\/(png|jpeg|jpg|webp);base64,/, ""), e);
                        s = URL.createObjectURL(a)
                    } else
                        s = o;
                    var h = document.createElement("a");
                    h.download = r,
                    h.href = s,
                    document.body.appendChild(h),
                    h.click(),
                    document.body.removeChild(h)
                }
                return o
            }
            return null
        }
        ,
        t.coordToPoint = function(t, e, i) {
            return this.coordinateToPoint(t, e, i)
        }
        ,
        t.coordToPointAtRes = function(t, e, i) {
            return this.coordinateToPointAtRes(t, e, i)
        }
        ,
        t.pointToCoord = function(t, e, i) {
            return this.pointToCoordinate(t, e, i)
        }
        ,
        t.pointAtResToCoord = function(t, e, i) {
            return this.pointAtResToCoordinate(t, e, i)
        }
        ,
        t.coordToViewPoint = function(t, e, i) {
            return this.coordinateToViewPoint(t, e, i)
        }
        ,
        t.viewPointToCoord = function(t, e) {
            return this.viewPointToCoordinate(t, e)
        }
        ,
        t.coordToContainerPoint = function(t, e, i) {
            return this.coordinateToContainerPoint(t, e, i)
        }
        ,
        t.containerPointToCoord = function(t, e) {
            return this.containerPointToCoordinate(t, e)
        }
        ,
        t.containerPointToViewPoint = function(t, e) {
            return e ? e.set(t.x, t.y) : e = t.copy(),
            e._sub(this.getViewPoint())
        }
        ,
        t.viewPointToContainerPoint = function(t, e) {
            return e ? e.set(t.x, t.y) : e = t.copy(),
            e._add(this.getViewPoint())
        }
        ,
        t.checkSize = function(t) {
            var e = x() - this._initTime < 1500 && 0 === this.width || 0 === this.height
              , i = this._getContainerDomSize()
              , n = this.height
              , r = this.width;
            if (!t && i.width === r && i.height === n)
                return this;
            Pi(this._containerDOM);
            var o = this.getCenter();
            if (this.options.fixCenterOnResize)
                this._updateMapSize(i);
            else {
                var s = this._getVisualHeight(this.getPitch())
                  , a = new dt(0,this.height - s)
                  , h = this._containerPointToPrj(a);
                this._updateMapSize(i);
                var l = this._getVisualHeight(this.getPitch())
                  , u = new dt(0,this.height - l);
                this._setPrjCoordAtContainerPoint(h, u),
                this._mapViewCoord = this._getPrjCenter()
            }
            var c = 0 === i.width || 0 === i.height || 0 === r || 0 === n;
            return (e || c) && (this._eventSilence = !0,
            this.setCenter(o),
            delete this._eventSilence),
            this._fireEvent("resize"),
            this
        }
        ,
        t.locate = function(t, e, i) {
            return this.getProjection()._locate(new Rr(t), e, i)
        }
        ,
        t.getMainPanel = function() {
            return this._getRenderer().getMainPanel()
        }
        ,
        t.getPanels = function() {
            return this._panels
        }
        ,
        t.remove = function() {
            var e = this;
            if (this.isRemoved())
                return this;
            this._fireEvent("removestart"),
            this._removeDomEvents(),
            this._clearHandlers(),
            this.removeBaseLayer();
            for (var t = this.getLayers(), i = 0; i < t.length; i++)
                t[i].remove();
            return this._getRenderer() && this._getRenderer().remove(),
            this._containerDOM.childNodes && 0 < this._containerDOM.childNodes.length && Array.prototype.slice.call(this._containerDOM.childNodes, 0).filter(function(t) {
                return "maptalks-wrapper" === t.className
            }).forEach(function(t) {
                return e._containerDOM.removeChild(t)
            }),
            delete this._panels,
            delete this._containerDOM,
            delete this.renderer,
            this._fireEvent("removeend"),
            this._clearAllListeners(),
            this
        }
        ,
        t.isRemoved = function() {
            return !this._containerDOM
        }
        ,
        t.isMoving = function() {
            return !!this._moving
        }
        ,
        t.onMoveStart = function(t) {
            this._mapAnimPlayer && this._stopAnim(this._mapAnimPlayer);
            var e = this._getPrjCenter();
            this._originCenter && !this._verifyExtent(e) || (this._originCenter = e),
            this._moving = !0,
            this._trySetCursor("move"),
            this._fireEvent("movestart", this._parseEvent(t ? t.domEvent : null, "movestart"))
        }
        ,
        t.onMoving = function(t) {
            this._fireEvent("moving", this._parseEvent(t ? t.domEvent : null, "moving"))
        }
        ,
        t.onMoveEnd = function(t) {
            if (this._moving = !1,
            this._suppressRecenter || this._recenterOnTerrain(),
            this._trySetCursor("default"),
            this._fireEvent("moveend", t && t.domEvent ? this._parseEvent(t.domEvent, "moveend") : t),
            !this._verifyExtent(this._getPrjCenter()) && this._originCenter) {
                var e = this._originCenter;
                this._panTo(e)
            }
        }
        ,
        t.onDragRotateStart = function(t) {
            this._dragRotating = !0,
            this._fireEvent("dragrotatestart", this._parseEvent(t ? t.domEvent : null, "dragrotatestart"))
        }
        ,
        t.onDragRotating = function(t) {
            this._fireEvent("dragrotating", this._parseEvent(t ? t.domEvent : null, "dragrotating"))
        }
        ,
        t.onDragRotateEnd = function(t) {
            this._dragRotating = !1,
            this._fireEvent("dragrotateend", this._parseEvent(t ? t.domEvent : null, "dragrotateend"))
        }
        ,
        t.isDragRotating = function() {
            return !!this._dragRotating
        }
        ,
        t.isOffscreen = function(t, e) {
            void 0 === e && (e = 0);
            var i = this.width + e
              , n = this.height + e
              , r = t.xmin
              , o = t.ymin
              , s = t.xmax
              , a = t.ymax;
            return Array.isArray(t) && (r = t[0],
            o = t[1],
            s = t[2],
            a = t[3]),
            s < e || i <= r || a < e || n < o
        }
        ,
        t.getRenderer = function() {
            return this._getRenderer()
        }
        ,
        t.getDevicePixelRatio = function() {
            return this.options.devicePixelRatio || $.devicePixelRatio || 1
        }
        ,
        t.setDevicePixelRatio = function(t) {
            return G(t) && 0 < t && t !== this.options.devicePixelRatio && (this.options.devicePixelRatio = t,
            this.checkSize(!0)),
            this
        }
        ,
        t._initContainer = function(t) {
            if (P(t)) {
                if (this._containerDOM = document.getElementById(t),
                !this._containerDOM)
                    throw new Error("Invalid container when creating map: '" + t + "'")
            } else
                this._containerDOM = t,
                f && (this.CanvasClass = this._containerDOM.constructor);
            if (this._containerDOM.childNodes && 0 < this._containerDOM.childNodes.length && "maptalks-wrapper" === this._containerDOM.childNodes[0].className)
                throw new Error("Container is already loaded with another map instance, use map.remove() to clear it.")
        }
        ,
        t._trySetCursor = function(t) {
            return this._cursor || this._priorityCursor || (t || (t = "default"),
            this._setCursorToPanel(t)),
            this
        }
        ,
        t._setPriorityCursor = function(t) {
            if (t)
                this._priorityCursor = t,
                this._setCursorToPanel(t);
            else {
                var e = !1;
                this._priorityCursor && (e = !0),
                delete this._priorityCursor,
                e && this.setCursor(this._cursor)
            }
            return this
        }
        ,
        t._setCursorToPanel = function(t) {
            var e = this.getMainPanel();
            e && e.style && e.style.cursor !== t && (e.style.cursor = t)
        }
        ,
        t._removeLayer = function(t, e) {
            if (t && e) {
                var i = e.indexOf(t);
                -1 < i && e.splice(i, 1)
            }
        }
        ,
        t._sortLayersByZIndex = function() {
            if (this._layers) {
                for (var t = 0, e = this._layers.length; t < e; t++)
                    this._layers[t]._order = t,
                    this._layers[t].sortLayersByZIndex && this._layers[t].sortLayersByZIndex();
                this._layers.sort(function(t, e) {
                    var i = t.getZIndex() - e.getZIndex();
                    return 0 === i ? t._order - e._order : i
                })
            }
        }
        ,
        t._fireEvent = function(t, e) {
            if (!this._eventSilence) {
                "_" !== t[0] && this.fire("_" + t, e),
                this.fire(t, e)
            }
        }
        ,
        t._Load = function() {
            this._resetMapStatus(),
            this.options.pitch && (this.setPitch(this.options.pitch),
            delete this.options.pitch),
            this.options.bearing && (this.setBearing(this.options.bearing),
            delete this.options.bearing),
            delete this._glRes,
            this._loadAllLayers(),
            this._getRenderer().onLoad(),
            this._loaded = !0,
            this._callOnLoadHooks(),
            this._initTime = x()
        }
        ,
        t._initRenderer = function() {
            var t = this.options.renderer
              , e = l.getRendererClass(t);
            this._renderer = new e(this),
            this._renderer.load()
        }
        ,
        t._getRenderer = function() {
            return this._renderer
        }
        ,
        t._loadAllLayers = function() {
            this._baseLayer && this._baseLayer.load(),
            this._eachLayer(function(t) {
                t && t.load()
            }, this.getLayers())
        }
        ,
        t._getLayers = function(t) {
            for (var e = this._baseLayer ? [this._baseLayer].concat(this._layers) : this._layers, i = [], n = 0; n < e.length; n++)
                t && !t.call(this, e[n]) || i.push(e[n]);
            return i
        }
        ,
        t._eachLayer = function(t) {
            if (!(arguments.length < 2)) {
                var e = Array.prototype.slice.call(arguments, 1);
                e && !Array.isArray(e) && (e = [e]);
                for (var i = [], n = 0, r = e.length; n < r; n++)
                    i = i.concat(e[n]);
                for (var o = 0, s = i.length; o < s; o++)
                    t.call(t, i[o])
            }
        }
        ,
        t._onLayerEvent = function(t) {
            t && "idchange" === t.type && (delete this._layerCache[t.old],
            this._layerCache[t.new] = t.target)
        }
        ,
        t._resetMapStatus = function() {
            var t = this.getMaxZoom()
              , e = this.getMinZoom()
              , i = this._spatialReference.getMaxZoom()
              , n = this._spatialReference.getMinZoom();
            (ut(t) || -1 === t || i < t) && this.setMaxZoom(i),
            (ut(e) || -1 === e || e < n) && this.setMinZoom(n),
            (t = this.getMaxZoom()) < (e = this.getMinZoom()) && this.setMaxZoom(e),
            (ut(this._zoomLevel) || this._zoomLevel > t) && (this._zoomLevel = t),
            this._zoomLevel < e && (this._zoomLevel = e),
            delete this._prjCenter,
            delete this._glRes;
            var r = this.getProjection();
            this._prjCenter = r.project(this._center),
            this._prjCenter.z = this._center.z,
            this._calcMatrices();
            var o = this._getRenderer();
            o && o.resetContainer()
        }
        ,
        t._getContainerDomSize = function() {
            if (!this._containerDOM)
                return null;
            var t, e, i = this._containerDOM;
            if (this._containerDomContentRect)
                return t = this._containerDomContentRect.width,
                e = this._containerDomContentRect.height,
                new Oe(t,e);
            if (ut(i.width) || ut(i.height)) {
                if (ut(i.clientWidth) || ut(i.clientHeight))
                    throw new Error("can not get size of container");
                t = parseInt(i.clientWidth, 0),
                e = parseInt(i.clientHeight, 0)
            } else {
                t = i.width,
                e = i.height;
                var n = this.getDevicePixelRatio();
                1 !== n && i.layer && (t /= n,
                e /= n)
            }
            return new Oe(t,e)
        }
        ,
        t._updateMapSize = function(t) {
            return this.width = t.width,
            this.height = t.height,
            this._getRenderer().updateMapSize(t),
            this._calcMatrices(),
            this
        }
        ,
        t._getPrjCenter = function() {
            return this._prjCenter
        }
        ,
        t._setPrjCenter = function(t) {
            this._prjCenter = t,
            this.isInteracting() && !this.isMoving() && (this._mapViewCoord = t),
            this._calcMatrices()
        }
        ,
        t._setPrjCoordAtContainerPoint = function(t, e) {
            if (!this.centerAltitude && e.x === this.width / 2 && e.y === this.height / 2)
                return this;
            var i = this._containerPointToPoint(e)._sub(this._prjToPoint(this._getPrjCenter()))
              , n = this._pointToPrj(this._prjToPoint(t).sub(i));
            return this._setPrjCenter(n),
            this
        }
        ,
        t._setPrjCoordAtOffsetToCenter = function(t, e) {
            var i = this._pointToPrj(this._prjToPoint(t).sub(e));
            return this._setPrjCenter(i),
            this
        }
        ,
        t._verifyExtent = function(t) {
            if (!t)
                return !1;
            var e = this._prjMaxExtent;
            return !e || e.contains(t)
        }
        ,
        t._offsetCenterByPixel = function(t) {
            var e = qa.set(this.width / 2 - t.x, this.height / 2 - t.y)
              , i = this._containerPointToPrj(e, Ja)
              , n = qa.set(this.width / 2, this.height / 2);
            this._setPrjCoordAtContainerPoint(i, n)
        }
        ,
        t.offsetPlatform = function(t) {
            return t ? (this._getRenderer().offsetPlatform(t),
            this._mapViewCoord = this._getPrjCenter(),
            this._mapViewPoint = this._mapViewPoint.add(t),
            this) : this._mapViewPoint
        }
        ,
        t.getViewPoint = function() {
            var t = this._getViewPointFrameOffset()
              , e = this.offsetPlatform();
            return t && (e = e.add(t)),
            e
        }
        ,
        t._resetMapViewPoint = function() {
            this._mapViewPoint = new dt(0,0),
            this._mapViewCoord = this._getPrjCenter()
        }
        ,
        t._getResolution = function(t) {
            return void 0 !== t && t !== this._zoomLevel || void 0 === this._mapRes ? (ut(t) && (t = this._zoomLevel),
            this._spatialReference.getResolution(t)) : this._mapRes
        }
        ,
        t._getResolutions = function() {
            return this._spatialReference.getResolutions()
        }
        ,
        t._prjToPoint = function(t, e, i) {
            e = ut(e) ? this.getZoom() : e;
            var n = this._getResolution(e);
            return this._prjToPointAtRes(t, n, i)
        }
        ,
        t._prjToPointAtRes = function(t, e, i) {
            return this._spatialReference.getTransformation().transform(t, e, i)
        }
        ,
        t._prjsToPointsAtRes = function(t, e, i) {
            void 0 === i && (i = []);
            for (var n = this._spatialReference.getTransformation(), r = [], o = 0, s = t.length; o < s; o++) {
                var a = n.transform(t[o], e, i[o]);
                r.push(a)
            }
            return r
        }
        ,
        t._pointToPrj = function(t, e, i) {
            e = ut(e) ? this.getZoom() : e;
            var n = this._getResolution(e);
            return this._pointToPrjAtRes(t, n, i)
        }
        ,
        t._pointToPrjAtRes = function(t, e, i) {
            return this._spatialReference.getTransformation().untransform(t, e, i)
        }
        ,
        t._pointToPoint = function(t, e, i) {
            return ut(e) ? (i ? (i.x = t.x,
            i.y = t.y) : i = t.copy(),
            i) : this._pointAtResToPoint(t, this._getResolution(e), i)
        }
        ,
        t._pointAtResToPoint = function(t, e, i) {
            return i ? (i.x = t.x,
            i.y = t.y) : i = t.copy(),
            i._multi(e / this._getResolution())
        }
        ,
        t._pointToPointAtRes = function(t, e, i) {
            return i ? (i.x = t.x,
            i.y = t.y) : i = t.copy(),
            i._multi(this._getResolution() / e)
        }
        ,
        t._containerPointToPrj = function(t, e) {
            return this._pointToPrj(this._containerPointToPoint(t, void 0, e), void 0, e)
        }
        ,
        t._callOnLoadHooks = function() {
            var t = l.prototype;
            if (t._onLoadHooks)
                for (var e = 0, i = t._onLoadHooks.length; e < i; e++)
                    t._onLoadHooks[e].call(this)
        }
        ,
        t._fixPrjOnWorldWide = function(t) {
            var e = this.getProjection();
            if (e && e.fullExtent && t) {
                var i = e.fullExtent || {}
                  , n = i.left
                  , r = i.bottom
                  , o = i.top
                  , s = i.right;
                G(n) && (t.x = Math.max(n, t.x)),
                G(s) && (t.x = Math.min(s, t.x)),
                G(r) && (t.y = Math.max(r, t.y)),
                G(o) && (t.y = Math.min(o, t.y))
            }
            return this
        }
        ,
        l
    }(Pr(Un(Ro(qn))));
    Qa.include({
        coordinateToPoint: function(t, e, i) {
            var n = this._getResolution(e);
            return this.coordinateToPointAtRes(t, n, i)
        },
        coordinateToPointAtRes: (Ua = new Rr(0,0),
        function(t, e, i) {
            var n = this.getProjection().project(t, Ua);
            return this._prjToPointAtRes(n, e, i)
        }
        ),
        pointToCoordinate: (Va = new Rr(0,0),
        function(t, e, i) {
            var n = this._pointToPrj(t, e, Va);
            return this.getProjection().unproject(n, i)
        }
        ),
        pointAtResToCoordinate: (Wa = new Rr(0,0),
        function(t, e, i) {
            var n = this._pointToPrjAtRes(t, e, Wa);
            return this.getProjection().unproject(n, i)
        }
        ),
        coordinateToViewPoint: (Za = new Rr(0,0),
        function(t, e, i) {
            return this._prjToViewPoint(this.getProjection().project(t, Za), e, i)
        }
        ),
        viewPointToCoordinate: (Na = new Rr(0,0),
        function(t, e) {
            return this.getProjection().unproject(this._viewPointToPrj(t, Na), e)
        }
        ),
        coordinateToContainerPoint: function(t, e, i) {
            var n = this._getResolution(e);
            return this.coordinateToContainerPointAtRes(t, n, i)
        },
        coordinateToContainerPointAtRes: (Ba = new Rr(0,0),
        function(t, e, i) {
            var n = this.getProjection().project(t, Ba);
            return this._prjToContainerPointAtRes(n, e, i)
        }
        ),
        coordinatesToContainerPoints: function(t, e) {
            var i = this._getResolution(e);
            return this.coordinatesToContainerPointsAtRes(t, i)
        },
        coordinatesToContainerPointsAtRes: function(t, e) {
            for (var i = [], n = this._spatialReference.getTransformation(), r = e / this._getResolution(), o = this.getProjection(), s = new Rr(0,0), a = this.isTransforming(), h = this._prjToPoint(this._getPrjCenter(), void 0, Ja), l = 0, u = t.length; l < u; l++) {
                var c = o.project(t[l], s)
                  , d = n.transform(c, e);
                d = d._multi(r),
                this._toContainerPoint(d, a, t[l].z, h),
                i.push(d)
            }
            return i
        },
        containerPointToCoordinate: (Ha = new Rr(0,0),
        function(t, e) {
            var i = this._containerPointToPrj(t, Ha);
            return this.getProjection().unproject(i, e)
        }
        ),
        containerToExtent: (Fa = new dt(0,0),
        Ga = new dt(0,0),
        function(t) {
            var e = new Vr(this._containerPointToPoint(t.getMin(Fa), void 0, Fa),this._containerPointToPoint(t.getMax(Ga), void 0, Ga));
            return this._pointToExtent(e)
        }
        ),
        distanceToPixel: (za = new dt(0,0),
        ja = new dt(0,0),
        function(t, e, i) {
            var n = this.getProjection();
            if (!n)
                return null;
            var r = this.getScale() / this.getScale(i)
              , o = this.getCenter()
              , s = n.locate(o, t, e)
              , a = this.coordToContainerPoint(o, void 0, za)
              , h = this.coordToContainerPoint(s, void 0, ja);
            return h._sub(a)._multi(r)._abs(),
            new Oe(h.x,h.y)
        }
        ),
        distanceToPoint: function(t, e, i, n) {
            var r = this._getResolution(i);
            return this.distanceToPointAtRes(t, e, r, n)
        },
        distanceToPointAtRes: (Da = new dt(0,0),
        Ia = new Rr(0,0),
        function(t, e, i, n, r) {
            var o = this.getProjection();
            if (!o)
                return null;
            var s = n || this.getCenter()
              , a = o.locate(s, t, e, Ia)
              , h = this.coordToPointAtRes(s, i, Da)
              , l = this.coordToPointAtRes(a, i, r);
            return l._sub(h)._abs(),
            l
        }
        ),
        altitudeToPoint: (Oa = new Rr(0,40),
        La = new dt(0,0),
        function(t, e, i) {
            void 0 === t && (t = 0),
            this._altitudeOriginDirty && (Oa.x = this._originLng,
            this._altitudeOriginDirty = !1);
            var n = this.distanceToPointAtRes(t, t, e, i || Oa, La);
            t < 0 && 0 < n.x && (n.x = -n.x);
            var r = this.options.heightFactor;
            return r && 1 !== r && (n.x *= r,
            n.y *= r),
            n.x
        }
        ),
        pointAtResToAltitude: (ka = new Rr(0,40),
        function(t, e, i) {
            return void 0 === t && (t = 0),
            this.pointAtResToDistance(t, 0, e, i || ka)
        }
        ),
        pixelToDistance: (Sa = new Rr(0,0),
        Ea = new Rr(0,0),
        Ra = new Rr(0,0),
        Aa = new Rr(0,0),
        function(t, e) {
            var i = this.getProjection();
            if (!i)
                return null;
            var n = this.getFullExtent()
              , r = n.top > n.bottom ? -1 : 1
              , o = Sa.set(this.width / 2, this.height / 2)
              , s = Ea.set(this.width / 2 + t, this.height / 2 + r * e)
              , a = this.containerPointToCoord(o, Ra)
              , h = this.containerPointToCoord(s, Aa);
            return i.measureLength(a, h)
        }
        ),
        pointToDistance: function(t, e, i) {
            var n = this.getResolution(i);
            return this.pointAtResToDistance(t, e, n)
        },
        pointAtResToDistance: (ba = new dt(0,0),
        Pa = new Rr(0,0),
        Ma = new Rr(0,0),
        Ta = new Rr(0,0),
        function(t, e, i, n) {
            var r = this.getProjection();
            if (!r)
                return null;
            var o = n ? r.project(n, Pa) : this._getPrjCenter()
              , s = this._prjToPointAtRes(o, i, ba);
            s._add(t, e);
            var a = this.pointAtResToCoord(s, i, Ma)
              , h = n || r.unproject(o, Ta);
            return r.measureLength(h, a)
        }
        ),
        locateByPoint: (Ca = new dt(0,0),
        function(t, e, i) {
            var n = this.coordToContainerPoint(t, void 0, Ca);
            return this.containerPointToCoord(n._add(e, i))
        }
        ),
        _get2DExtent: function(t, e) {
            var i;
            if (void 0 !== t && t !== this._zoomLevel || !this._mapExtent2D || (i = this._mapExtent2D),
            i)
                return e ? (e.set(i.xmin, i.ymin, i.xmax, i.ymax),
                e) : i.copy();
            var n = this._getResolution(t);
            return this._get2DExtentAtRes(n, e)
        },
        _get2DExtentAtRes: (wa = new dt(0,0),
        function(e, t) {
            var i = this;
            return e === this._mapGlRes && this._mapGlExtent2D ? this._mapGlExtent2D : this.getContainerExtent().convertTo(function(t) {
                return i._containerPointToPointAtRes(t, e, wa)
            }, t)
        }
        ),
        _pointToExtent: (ya = new Rr(0,0),
        xa = new Rr(0,0),
        function(t) {
            var e = t.getMin()
              , i = t.getMax()
              , n = this.getFullExtent()
              , r = !n || n.left <= n.right ? [e.x, i.x] : [i.x, e.x]
              , o = r[0]
              , s = r[1]
              , a = !n || n.top > n.bottom ? [i.y, e.y] : [e.y, i.y]
              , h = a[0]
              , l = a[1]
              , u = e.set(o, l)
              , c = i.set(s, h);
            return new Zr(this.pointToCoord(u, void 0, ya),this.pointToCoord(c, void 0, xa),this.getProjection())
        }
        ),
        _getViewPointFrameOffset: (va = new dt(0,0),
        function() {
            if (this.isZooming())
                return null;
            var t = this._getPrjCenter();
            return this._mapViewCoord && !this._mapViewCoord.equals(t) ? this._prjToContainerPoint(this._mapViewCoord)._sub(this._prjToContainerPoint(t, void 0, va)) : null
        }
        ),
        _viewPointToPrj: (_a = new dt(0,0),
        function(t, e) {
            return this._containerPointToPrj(this.viewPointToContainerPoint(t, _a), e)
        }
        ),
        _prjToContainerPoint: function(t, e, i, n) {
            var r = this._getResolution(e);
            return this._prjToContainerPointAtRes(t, r, i, n)
        },
        _prjToContainerPointAtRes: (ma = new dt(0,0),
        function(t, e, i, n) {
            return this._pointAtResToContainerPoint(this._prjToPointAtRes(t, e, ma), e, n || 0, i)
        }
        ),
        _prjToViewPoint: (pa = new dt(0,0),
        function(t, e, i) {
            var n = this._prjToContainerPoint(t, void 0, pa, i);
            return this.containerPointToViewPoint(n, e)
        }
        ),
        _viewPointToPoint: (ga = new dt(0,0),
        function(t, e, i) {
            return this._containerPointToPoint(this.viewPointToContainerPoint(t, ga), e, i)
        }
        ),
        _pointToViewPoint: (fa = new Rr(0,0),
        function(t, e, i) {
            return this._prjToViewPoint(this._pointToPrj(t, e, fa), i)
        }
        )
    }),
    Qa.mergeOptions(Ya);
    var Ka = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addHooks = function() {
            this.target && this.target.on("_dblclick", this._onDoubleClick, this)
        }
        ,
        i.removeHooks = function() {
            this.target && this.target.off("_dblclick", this._onDoubleClick, this)
        }
        ,
        i._onDoubleClick = function(t) {
            var e = this.target;
            if (e.options.doubleClickZoom) {
                var i = e.getZoom()
                  , n = t.domEvent.shiftKey ? Math.ceil(i) - 1 : Math.floor(i) + 1;
                e._zoomAnimation(n, t.containerPoint)
            }
        }
        ,
        e
    }(Jn);
    Qa.mergeOptions({
        doubleClickZoom: !0
    }),
    Qa.addOnLoadHook("addHandler", "doubleClickZoom", Ka);
    var $a = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addHooks = function() {
            var t = this.target;
            if (t) {
                var e = t._panels.mapWrapper || t._containerDOM;
                this._dragHandler = new Er(e,{
                    cancelOn: this._cancelOn.bind(this),
                    rightclick: !0
                }),
                this._dragHandler.on("mousedown", this._onMouseDown, this).on("dragstart", this._onDragStart, this).on("dragging", this._onDragging, this).on("dragend", this._onDragEnd, this).enable()
            }
        }
        ,
        i.removeHooks = function() {
            this._dragHandler.off("mousedown", this._onMouseDown, this).off("dragstart", this._onDragStart, this).off("dragging", this._onDragging, this).off("dragend", this._onDragEnd, this),
            this._dragHandler.remove(),
            delete this._dragHandler
        }
        ,
        i._cancelOn = function(t) {
            return !(!this.target.isZooming() && !this._ignore(t))
        }
        ,
        i._ignore = function(t) {
            return !!t && (t.domEvent && (t = t.domEvent),
            this.target._ignoreEvent(t) || this.target._isEventOutMap(t))
        }
        ,
        i._onMouseDown = function(t) {
            delete this.startDragTime,
            delete this._mode;
            var e = this.target.options.switchDragButton
              , i = e ? 0 : 2
              , n = "touchstart" === t.domEvent.type;
            e && n || t.domEvent.button === i || t.domEvent.ctrlKey ? (this.target.options.dragRotate || this.target.options.dragPitch) && (this._mode = "rotatePitch") : this.target.options.dragPan && (this._mode = "move"),
            this.target._stopAnim(this.target._mapAnimPlayer),
            xi(t.domEvent)
        }
        ,
        i._onDragStart = function(t) {
            this.startDragTime = x(),
            "move" === this._mode ? this._moveStart(t) : "rotatePitch" === this._mode && this._rotateStart(t)
        }
        ,
        i._onDragging = function(t) {
            this.target._isEventOutMap(t.domEvent) || ("move" === this._mode ? this._moving(t) : "rotatePitch" === this._mode && this._rotating(t))
        }
        ,
        i._onDragEnd = function(t) {
            "move" === this._mode ? this._moveEnd(t) : "rotatePitch" === this._mode && this._rotateEnd(t),
            delete this.startDragTime,
            delete this.startBearing
        }
        ,
        i._start = function(t) {
            this.preX = t.mousePos.x,
            this.preY = t.mousePos.y,
            this.startX = this.preX,
            this.startY = this.preY,
            this._startPrjCenter = this.target._getPrjCenter().copy()
        }
        ,
        i._moveStart = function(t) {
            this._start(t);
            var e = this.target;
            e.onMoveStart(t);
            var i = Mi(e._getActualEvent(t.domEvent), e.getContainer());
            this.startPrjCoord = this._containerPointToPrj(i)
        }
        ,
        i._moving = function(t) {
            if (this.startDragTime) {
                var e = this.target
                  , i = Mi(e._getActualEvent(t.domEvent), e.getContainer())
                  , n = e._prjToPoint(this._containerPointToPrj(i))._sub(e._prjToPoint(e._getPrjCenter()));
                e._setPrjCoordAtOffsetToCenter(this.startPrjCoord, n),
                e.onMoving(t)
            }
        }
        ,
        i._containerPointToPrj = function(t) {
            var e = this.target
              , i = e._queryTerrainInfo(t);
            if (i) {
                var n = e.getProjection().project(i.coordinate);
                return n.z = i.altitude,
                n
            }
            return e._containerPointToPrj(t)
        }
        ,
        i._moveEnd = function(t) {
            if (this.startDragTime) {
                var e = "touchend" === t.domEvent.type
                  , i = this.target
                  , n = x() - this.startDragTime
                  , r = t.mousePos.x
                  , o = t.mousePos.y
                  , s = r - this.startX
                  , a = o - this.startY
                  , h = i._getPrjCenter()
                  , l = h.sub(this._startPrjCenter);
                if (this._clear(),
                i.options.panAnimation && !t.interupted && i._verifyExtent(i._getPrjCenter()) && n < 280 && 5 < Math.abs(a) + Math.abs(s)) {
                    n *= 5;
                    var u = e ? 5 : 2.8
                      , c = h.add(l._multi(u));
                    i._panTo(c, {
                        duration: e ? 3 * n : 2 * n,
                        easing: "outExpo"
                    })
                } else
                    i.onMoveEnd(t)
            }
        }
        ,
        i._rotateStart = function(t) {
            this._start(t),
            delete this._rotateMode,
            this.startBearing = this.target.getBearing(),
            this.target.onDragRotateStart(t),
            this._db = 0
        }
        ,
        i._rotating = function(t) {
            var e = this.target
              , i = t.mousePos.x
              , n = t.mousePos.y
              , r = e.getPitch()
              , o = e.getBearing()
              , s = Math.abs(i - this.preX)
              , a = Math.abs(n - this.preY);
            if (this._rotateMode || (e.options.dragRotatePitch ? this._rotateMode = "rotate_pitch" : this._rotateMode = a < s ? "rotate" : s < a ? "pitch" : "rotate"),
            !("pitch" === this._rotateMode && 0 === r && a < 10)) {
                if (0 <= this._rotateMode.indexOf("rotate") && e.options.dragRotate) {
                    var h = 0;
                    h = e.options.dragPitch || a < s ? -.15 * (this.preX - i) : i > e.width / 2 ? .15 * (this.preY - n) : -.15 * (this.preY - n);
                    var l = e.getBearing() + h;
                    this._db = this._db || 0,
                    this._db += h,
                    e._setBearing(l)
                }
                0 <= this._rotateMode.indexOf("pitch") && e.options.dragPitch && e._setPitch(e.getPitch() + .15 * (this.preY - n)),
                this.preX = i,
                this.preY = n,
                e.getBearing() === o && e.getPitch() === r || e.onDragRotating(t)
            }
        }
        ,
        i._rotateEnd = function(t) {
            var e = this.target
              , i = e.getBearing();
            this._clear();
            var n = x() - this.startDragTime;
            if (e.onDragRotateEnd(t),
            e.options.rotateAnimation && 20 < Math.abs(i - this.startBearing) && ("rotate" === this._rotateMode || "rotate_pitch" === this._rotateMode) && !t.interupted && n < 400) {
                var r = e.getBearing();
                e._animateTo({
                    bearing: r + this._db / 1.5
                }, {
                    easing: "outQuint",
                    duration: 1600
                })
            }
        }
        ,
        i._clear = function() {
            delete this.startPrjCoord,
            delete this.preX,
            delete this.preY,
            delete this.startX,
            delete this.startY
        }
        ,
        e
    }(Jn);
    Qa.mergeOptions({
        draggable: !0,
        dragPan: !0,
        dragRotatePitch: !0,
        dragRotate: !0,
        dragPitch: !0
    }),
    Qa.addOnLoadHook("addHandler", "draggable", $a);
    var th = "mousedown mouseup mousemove click dblclick contextmenu touchstart touchmove touchend mouseout"
      , eh = {
        mousemove: ["mousemove", "mouseover", "mouseout", "mouseenter"],
        touchend: ["touchend", "click"]
    }
      , ih = function(t) {
        return t && t.getLayer && t.on && t.fire
    }
      , nh = function(t) {
        return t._getInternalId ? t._getInternalId() : t.getId ? t.getId() : null
    }
      , rh = function(t, e, i) {
        if (t._onEvent)
            return t._onEvent(e, i);
        var n = t.getLayer();
        return n && n.fireGeoEvent ? n.fireGeoEvent(t, e, i) : null
    }
      , oh = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addHooks = function() {
            var t = this.target
              , e = t._panels.allLayers || t._containerDOM;
            Ii(e, th, this._identifyGeometryEvents, this)
        }
        ,
        i.removeHooks = function() {
            var t = this.target
              , e = t._panels.allLayers || t._containerDOM;
            zi(e, th, this._identifyGeometryEvents, this)
        }
        ,
        i._identifyGeometryEvents = function(d, t) {
            var f = this.target;
            if (!f.isInteracting() && !f._ignoreEvent(d)) {
                var g = null
                  , p = t || d.type;
                if (ji(p) && !y.isTest && Fi(this, f.options.mousemoveThrottleTime))
                    wi(d);
                else {
                    var e = "mousedown" === p || "touchstart" === p && d.touches && 1 === d.touches.length;
                    if (e)
                        this._mouseDownTime = x();
                    else if (("click" === p || "touchend" === p) && this._mouseDownTime) {
                        var i = this._mouseDownTime;
                        if (delete this._mouseDownTime,
                        300 < x() - i) {
                            if ("click" === p)
                                return
                        } else
                            "touchend" === p && (g = "click")
                    }
                    var n = d.touches && 0 < d.touches.length ? d.touches[0] : d.changedTouches && 0 < d.changedTouches.length ? d.changedTouches[0] : d;
                    if (n) {
                        var r = Mi(n, f._containerDOM);
                        "touchstart" === p && f.options.preventTouch && xi(d);
                        for (var m = null, o = this.target.getRenderer().getTopElements(), s = e && 2 !== d.button, a = 0; a < o.length; a++)
                            if (o[a].hitTest(r)) {
                                var h = o[a].options.cursor;
                                if (h && (m = h),
                                s || o[a].events && 0 <= o[a].events.indexOf(p)) {
                                    var l = {
                                        target: f,
                                        type: p,
                                        domEvent: d,
                                        containerPoint: r
                                    };
                                    if (s)
                                        return f._setPriorityCursor(m),
                                        void o[a].mousedown(l);
                                    o[a].onEvent(l)
                                }
                            }
                        var u = f._getLayers(function(t) {
                            return !(!t.identify || !t.options.geometryEvents)
                        });
                        if (u.length) {
                            var c = eh[p] || [p]
                              , _ = {
                                includeInternals: !0,
                                filter: function(t) {
                                    if (t instanceof sa) {
                                        var e = t._getEventTypeToFire(d);
                                        return "mousemove" === p ? (!m && t.options.cursor && (m = t.options.cursor),
                                        !0) : !(!t.listens(e) && !t.listens(g))
                                    }
                                    return !!ih(t)
                                },
                                count: 1,
                                onlyVisible: f.options.onlyVisibleGeometryEvents,
                                containerPoint: r,
                                layers: u,
                                eventTypes: c,
                                domEvent: d
                            }
                              , v = function(t) {
                                var e = this
                                  , o = !0
                                  , i = function() {
                                    var t = e._prevOverGeos && e._prevOverGeos.geos;
                                    return t || []
                                }
                                  , n = function(t, e) {
                                    if (void 0 === t && (t = []),
                                    void 0 === e && (e = {}),
                                    t && 0 < t.length)
                                        for (var i = t.length - 1; 0 <= i; i--) {
                                            var n = t[i];
                                            if (ih(n)) {
                                                var r = nh(t[i]);
                                                e[r] || (o = rh(n, d, "mouseout"))
                                            }
                                        }
                                };
                                if ("mouseout" === p) {
                                    var r = i();
                                    this._prevOverGeos = {
                                        geos: [],
                                        geomap: {}
                                    },
                                    n(r, {})
                                } else if ("mousemove" === p) {
                                    var s = {};
                                    if (0 < t.length)
                                        for (var a = t.length - 1; 0 <= a; a--) {
                                            var h = t[a];
                                            if (ih(h)) {
                                                var l = nh(h);
                                                s[l] = h,
                                                rh(h, d),
                                                this._prevOverGeos && this._prevOverGeos.geomap[l] || rh(h, d, "mouseenter"),
                                                o = rh(h, d, "mouseover")
                                            }
                                        }
                                    f._setPriorityCursor(m);
                                    var u = i();
                                    this._prevOverGeos = {
                                        geos: t,
                                        geomap: s
                                    },
                                    n(u, s)
                                } else {
                                    if (!t || !t.length)
                                        return;
                                    for (var c = t.length - 1; 0 <= c; c--)
                                        if (ih(t[c])) {
                                            o = rh(t[c], d),
                                            g && rh(t[c], d, g);
                                            break
                                        }
                                }
                                !1 === o && wi(d)
                            }
                            .bind(this);
                            ji(p) ? this._queryIdentifyTimeout = f.getRenderer().callInNextFrame(function() {
                                f.isInteracting() || f.identifyAtPoint(_, v)
                            }) : f.identifyAtPoint(_, v)
                        }
                    }
                }
            }
        }
        ,
        e
    }(Jn);
    Qa.mergeOptions({
        geometryEvents: !0,
        onlyVisibleGeometryEvents: !0
    }),
    Qa.addOnLoadHook("addHandler", "geometryEvents", oh);
    var sh = 4.000244140625
      , ah = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this)._thisScrollZoom = e._scrollZoom.bind(at(at(e))),
            e._wheelZoomRate = 1 / 450,
            e._defaultZoomRate = .01,
            e._delta = 0,
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.addHooks = function() {
            _i(this.target._containerDOM, "wheel", this._onWheelScroll, this)
        }
        ,
        e.removeHooks = function() {
            vi(this.target._containerDOM, "wheel", this._onWheelScroll)
        }
        ,
        e._onWheelScroll = function(t) {
            var e = this.target;
            if (e.options.preventWheelScroll && (xi(t),
            wi(t)),
            e._ignoreEvent(t) || e._isEventOutMap(t) || !e.options.zoomable)
                return !1;
            var i = e._containerDOM
              , n = e._checkZoomOrigin(Mi(t, i));
            return e.options.seamlessZoom ? (this._zooming || (this._trackPadSuspect = 0,
            this._ensureTrackpad = !1),
            this._seamless(t, n)) : this._interval(t, n)
        }
        ,
        e._seamless = function(t, e) {
            var i = t.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? 60 * t.deltaY : t.deltaY;
            if (i % sh != 0 && (this._ensureTrackpad || (Math.abs(i) < 60 ? this._trackPadSuspect++ : this._trackPadSuspect = 0,
            2 <= this._trackPadSuspect && (this._ensureTrackpad = !0)),
            this._ensureTrackpad && (i *= 14)),
            t.shiftKey && i && (i /= 4),
            this._lastWheelEvent = t,
            this._delta -= i,
            !this._zooming && this._delta) {
                var n = this.target;
                this._zoomOrigin = e,
                n.onZoomStart(null, e)
            }
            this._start()
        }
        ,
        e._start = function() {
            if (this._delta) {
                this._zooming = !0;
                var t = this.target;
                this._active || (t.getRenderer().callInNextFrame(this._thisScrollZoom),
                this._active = !0)
            }
        }
        ,
        e._scrollZoom = function() {
            var t = this;
            if (this._active = !1,
            this._delta) {
                var e = Math.abs(this._delta) > sh ? this._wheelZoomRate : this._defaultZoomRate
                  , i = 2 / (1 + Math.exp(-Math.abs(this._delta * e)));
                this._delta < 0 && 0 !== i && (i = 1 / i);
                var n = this.target
                  , r = n.getZoom()
                  , o = n.getZoomForScale(i, r, !0);
                this._delta = 0,
                n.onZooming(o, this._zoomOrigin),
                this._timeout && clearTimeout(this._timeout),
                this._timeout = setTimeout(function() {
                    t._zooming = !1,
                    delete t._timeout,
                    n.onZoomEnd(n.getZoom(), t._zoomOrigin)
                }, 210)
            }
        }
        ,
        e._interval = function(e, t) {
            var i = this
              , n = this.target;
            if (this._zooming)
                return this._requesting++,
                !1;
            var r = (this._requesting = 0) < (e.deltaY ? -1 * e.deltaY : e.wheelDelta ? e.wheelDelta : e.detail) ? 1 : -1;
            e.detail && (r *= -1);
            var o = n.getZoom()
              , s = o + r;
            if ((s = n._checkZoom(0 < r ? Math.ceil(s) : Math.floor(s))) === o)
                return !1;
            this._zooming = !0,
            this._delta || (n.onZoomStart(null, t),
            this._origin = t,
            this._delta = r,
            this._startZoom = n.getZoom());
            return n._animateTo({
                zoom: s - 1 * this._delta / 2,
                around: this._origin
            }, {
                continueOnViewChanged: !0,
                easing: "linear",
                duration: 90,
                wheelZoom: !0
            }, function(t) {
                "finished" === t.state.playState ? i._requesting < 1 || 2 < Math.abs(s - i._startZoom) || s === n.getMaxZoom() || s === n.getMinZoom() ? (n._animateTo({
                    zoom: s,
                    around: i._origin
                }, {
                    continueOnViewChanged: !0,
                    duration: 100
                }, function(t) {
                    "running" !== t.state.playState && (delete i._zooming,
                    delete i._requesting)
                }),
                delete i._startZoom,
                delete i._origin,
                delete i._delta,
                i._requesting = 0) : ut(i._requesting) || (delete i._zooming,
                i._onWheelScroll(e)) : "running" !== t.state.playState && (delete i._zooming,
                delete i._requesting)
            }),
            !1
        }
        ,
        t
    }(Jn);
    Qa.mergeOptions({
        scrollWheelZoom: !0,
        seamlessZoom: !0
    }),
    Qa.addOnLoadHook("addHandler", "scrollWheelZoom", ah);
    var hh = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addHooks = function() {
            _i(this.target.getContainer(), "touchstart", this._onTouchStart, this)
        }
        ,
        i.removeHooks = function() {
            vi(this.target.getContainer(), "touchstart", this._onTouchStart)
        }
        ,
        i._onTouchStart = function(t) {
            var e = this.target;
            if (t.touches && !(t.touches.length < 2)) {
                var i = e.getContainer()
                  , n = Mi(t.touches[0], i)
                  , r = Mi(t.touches[1], i);
                this.preY = n.y,
                this._startP1 = n,
                this._startP2 = r,
                this._startDist = n.distanceTo(r),
                this._startVector = n.sub(r),
                this._startZoom = e.getZoom(),
                this._startBearing = e.getBearing(),
                zi(document, "touchmove", this._onTouchMove, this),
                zi(document, "touchend", this._onTouchEnd, this),
                _i(document, "touchmove", this._onTouchMove, this),
                _i(document, "touchend", this._onTouchEnd, this),
                e.options.preventTouch && xi(t),
                e._fireEvent("touchactstart")
            }
        }
        ,
        i._onTouchMove = function(t) {
            var e = this.target;
            if (t.touches && !(t.touches.length < 2)) {
                var i = e.getContainer()
                  , n = Mi(t.touches[0], i)
                  , r = Mi(t.touches[1], i)
                  , o = n.sub(this._startP1)
                  , s = r.sub(this._startP2)
                  , a = n.sub(r)
                  , h = n.distanceTo(r) / this._startDist
                  , l = 180 * a.angleWith(this._startVector) / Math.PI
                  , u = .4 * ((this.preY || n.y) - n.y);
                this.preY = n.y;
                var c = {
                    domEvent: t,
                    mousePos: [n, r]
                };
                if (this.mode || (e.options.touchRotate && 8 < Math.abs(l) ? this.mode = e.options.touchZoomRotate ? "rotate_zoom" : "rotate" : e.options.touchPitch && 0 < o.y * s.y && 10 < Math.abs(o.y) && 10 < Math.abs(s.y) ? this.mode = "pitch" : e.options.zoomable && e.options.touchZoom && .15 < Math.abs(1 - h) && (this.mode = e.options.touchZoomRotate && e.options.touchRotate ? "rotate_zoom" : "zoom"),
                this._startTouching(c)),
                "zoom" === this.mode || "rotate_zoom" === this.mode) {
                    this._scale = h;
                    var d = e._getResolution(this._startZoom) / h
                      , f = e.getZoomFromRes(d);
                    e.onZooming(f, this._Origin)
                }
                "rotate" === this.mode || "rotate_zoom" === this.mode ? (e._setBearing(this._startBearing + l),
                e.onDragRotating(c)) : "pitch" === this.mode && (e._setPitch(e.getPitch() + u),
                e.onDragRotating(c)),
                e._fireEvent("touchactinging")
            }
        }
        ,
        i._startTouching = function(t) {
            var e = this.target;
            if ("zoom" === this.mode || "rotate_zoom" === this.mode) {
                var i = e.getSize();
                this._Origin = new dt(i.width / 2,i.height / 2),
                e.onZoomStart(null, this._Origin)
            }
            "rotate" !== this.mode && "pitch" !== this.mode && "rotate_zoom" !== this.mode || e.onDragRotateStart(t)
        }
        ,
        i._onTouchEnd = function(t) {
            delete this.preY;
            var e = this.target;
            if (zi(document, "touchmove", this._onTouchMove, this),
            zi(document, "touchend", this._onTouchEnd, this),
            "zoom" === this.mode || "rotate_zoom" === this.mode) {
                var i = this._scale
                  , n = e._getResolution(this._startZoom) / i
                  , r = e.getZoomFromRes(n);
                e.onZoomEnd(r, this._Origin)
            }
            "pitch" !== this.mode && "rotate" !== this.mode && "rotate_zoom" !== this.mode || e.onDragRotateEnd({
                domEvent: t
            }),
            delete this.mode,
            e._fireEvent("touchactend")
        }
        ,
        e
    }(Jn);
    Qa.mergeOptions({
        touchGesture: !0,
        touchZoom: !0,
        touchPitch: !0,
        touchRotate: !0,
        touchZoomRotate: !1
    }),
    Qa.addOnLoadHook("addHandler", "touchGesture", hh);
    var lh = "__anim_player"
      , uh = {
        outExpo: function(t) {
            return 1 === t ? 1 : 1 - Math.pow(2, -10 * t)
        },
        outQuint: function(t) {
            return 1 - Math.pow(1 - t, 5)
        },
        in: function(t) {
            return Math.pow(t, 2)
        },
        out: function(t) {
            return 1 - uh.in(1 - t)
        },
        inAndOut: function(t) {
            return 3 * t * t - 2 * t * t * t
        },
        linear: function(t) {
            return t
        },
        upAndDown: function(t) {
            return t < .5 ? uh.inAndOut(2 * t) : 1 - uh.inAndOut(2 * (t - .5))
        }
    }
      , ch = function() {
        function t(t, e) {
            this.state = t,
            this.styles = e
        }
        var e, i, n;
        return e = t,
        (i = [{
            key: "playState",
            get: function() {
                return this.state.playState
            }
        }, {
            key: "symbol",
            get: function() {
                return this.styles.symbol
            }
        }]) && tt(e.prototype, i),
        n && tt(e, n),
        Object.defineProperty(e, "prototype", {
            writable: !1
        }),
        t
    }()
      , dh = function(t, e, i, n) {
        this._animation = t,
        this.options = e,
        this._onFrame = i,
        this.playState = "idle",
        this.ready = !0,
        this.finished = !1,
        this.target = n
    }
      , fh = {
        speed: {
            slow: 2e3,
            normal: 1e3,
            fast: 500
        },
        _resolveStyles: function(t) {
            if (!t)
                return null;
            function e(t) {
                if (!Array.isArray(t))
                    return fh._resolveStyles(t);
                for (var e = [], i = [], n = [], r = 0; r < t.length; r++) {
                    var o = fh._resolveStyles(t[r]);
                    o && (e.push(o[0]),
                    i.push(o[1]),
                    n.push(o[2]))
                }
                return e.length ? [e, i, n] : null
            }
            function i(t) {
                var e, i = t;
                Array.isArray(t) || (i = G(t) ? [0, t] : t instanceof dt || t instanceof Rr ? [new (e = t.constructor)(0,0), t] : [t, t]);
                var n = i[0]
                  , r = i[1];
                return G(n) && G(r) ? n === r ? null : [n, r - n, r] : Array.isArray(n) && G(n[0]) || n instanceof Rr || n instanceof dt ? (Array.isArray(n) ? (n = new Rr(n),
                r = new Rr(r)) : (n = new (e = n.constructor)(n),
                r = new e(r)),
                n.equals(r) ? null : [n, r.sub(n), r]) : [n, r, r]
            }
            var n, r = {}, o = {}, s = {};
            for (var a in t)
                if (t.hasOwnProperty(a)) {
                    var h = t[a];
                    if (!h)
                        continue;
                    if (Array.isArray(h) && (ut(h[0]) || ut(h[1])))
                        continue;
                    var l = void 0;
                    n = h,
                    (l = !Array.isArray(n) && n.constructor === Object || Array.isArray(n) && n[0].constructor === Object ? e(h) : i(h)) && (o[a] = l[0],
                    r[a] = l[1],
                    s[a] = l[2])
                }
            return [o, r, s]
        },
        framing: function(t, e) {
            e || (e = {});
            var o, s, u, a = e.easing ? uh[e.easing] : uh.linear;
            a || (a = uh.linear),
            (t = fh._resolveStyles(t)) && (s = t[0],
            o = t[1],
            u = t[2]);
            return function(t, e) {
                var i, n;
                if (t < 0)
                    i = {
                        playState: "idle",
                        delta: 0
                    },
                    n = s;
                else if (t < e) {
                    var r = a(t / e);
                    i = {
                        playState: "running",
                        delta: r
                    },
                    n = function t(e, i, n) {
                        if (!i || !n)
                            return null;
                        var r = {};
                        for (var o in n)
                            if (n.hasOwnProperty(o)) {
                                if (i[o] === u[o]) {
                                    r[o] = i[o];
                                    continue
                                }
                                var s = i[o]
                                  , a = n[o];
                                if (G(a))
                                    r[o] = s + e * a;
                                else if (Array.isArray(a)) {
                                    for (var h = [], l = 0; l < a.length; l++)
                                        h.push(t(e, s[l], a[l]));
                                    r[o] = h
                                } else
                                    a.constructor === Object ? r[o] = t(e, s, a) : r[o] = s instanceof dt || s instanceof Rr ? s.add(a.multi(e)) : a
                            }
                        return r
                    }(r, s, o)
                } else
                    i = {
                        playState: "finished",
                        delta: 1
                    },
                    n = u;
                return i.startStyles = s,
                i.destStyles = u,
                i.progress = t,
                i.remainingMs = e - t,
                new ch(i,n)
            }
        },
        _requestAnimFrame: function(t) {
            this._frameQueue || (this._frameQueue = []),
            this._frameQueue.push(t),
            this._a()
        },
        _a: function() {
            this._animationFrameId || (this._animationFrameId = ht(fh._frameFn))
        },
        _run: function() {
            if (this._frameQueue.length) {
                var t = this._frameQueue;
                this._frameQueue = [];
                for (var e = 0, i = t.length; e < i; e++)
                    t[e]();
                this._frameQueue.length ? this._animationFrameId = ht(fh._frameFn) : delete this._animationFrameId
            }
        },
        animate: function(t, e, i, n) {
            e || (e = {});
            var r = fh.framing(t, e);
            return new dh(r,e,i,n)
        }
    };
    fh._frameFn = fh._run.bind(fh),
    F(dh.prototype, {
        _prepare: function() {
            var t = this.options
              , e = t.speed || t.duration;
            P(e) && ((e = fh.speed[e]) || (e = +e)),
            e || (e = fh.speed.normal),
            this.duration = e,
            this._framer = t.framer || fh._requestAnimFrame.bind(fh)
        },
        play: function() {
            if ("idle" !== this.playState && "paused" !== this.playState || this.target && this.target[lh])
                return this;
            this.target && (this.target[lh] = 1),
            "idle" === this.playState && (this.currentTime = 0,
            this._prepare());
            var t = x();
            if (!this.startTime) {
                var e = this.options;
                this.startTime = e.startTime ? e.startTime : t
            }
            return this._playStartTime = Math.max(t, this.startTime),
            "paused" === this.playState && (this._playStartTime -= this.currentTime),
            this.playState = "running",
            this._run(),
            this
        },
        pause: function() {
            return "paused" === this.playState || (this.playState = "paused",
            this._run()),
            this
        },
        cancel: function() {
            return "idle" === this.playState || (this.playState = "idle",
            this.finished = !1,
            this._run()),
            this
        },
        finish: function() {
            return "finished" === this.playState || (this.playState = "finished",
            this.finished = !0,
            this._run()),
            this
        },
        reverse: function() {},
        _run: function() {
            var t = this
              , e = this._onFrame
              , i = x()
              , n = i - this._playStartTime;
            if (this.options.repeat && n >= this.duration && (this._playStartTime = i,
            n = 0),
            "running" === this.playState) {
                var r = this._animation(n, this.duration);
                this.playState = r.state.playState,
                "running" !== this.playState && this.target && delete this.target[lh],
                "idle" === this.playState ? this.startTime > i && setTimeout(this._run.bind(this), this.startTime - i) : "running" === this.playState ? this._framer(function() {
                    "running" === t.playState && (t.currentTime = n,
                    e && e(r),
                    t._run())
                }) : "finished" === this.playState && (this.finished = !0,
                e && e(r))
            } else if (this.target && delete this.target[lh],
            e) {
                "finished" === this.playState ? n = this.duration : "idle" === this.playState && (n = 0);
                var o = this._animation(n, this.duration);
                o.state.playState = this.playState,
                e(o)
            }
        }
    });
    var gh = fh.animate
      , ph = Object.freeze({
        Animation: fh,
        Easing: uh,
        Player: dh,
        Frame: ch,
        animate: gh
    })
      , mh = Bi(function(e) {
        !function() {
            function u(t, e, i) {
                var n = e.x
                  , r = e.y
                  , o = i.x - n
                  , s = i.y - r;
                if (0 !== o || 0 !== s) {
                    var a = ((t.x - n) * o + (t.y - r) * s) / (o * o + s * s);
                    1 < a ? (n = i.x,
                    r = i.y) : 0 < a && (n += o * a,
                    r += s * a)
                }
                return (o = t.x - n) * o + (s = t.y - r) * s
            }
            function r(t, e) {
                var i = t.length - 1
                  , n = [t[0]];
                return function t(e, i, n, r, o) {
                    for (var s, a = r, h = i + 1; h < n; h++) {
                        var l = u(e[h], e[i], e[n]);
                        a < l && (s = h,
                        a = l)
                    }
                    r < a && (1 < s - i && t(e, i, s, r, o),
                    o.push(e[s]),
                    1 < n - s && t(e, s, n, r, o))
                }(t, 0, i, e, n),
                n.push(t[i]),
                n
            }
            function t(t, e, i) {
                if (t.length <= 2)
                    return t;
                var n = void 0 !== e ? e * e : 1;
                return t = r(t = i ? t : function(t, e) {
                    for (var i, n, r, o, s, a = t[0], h = [a], l = 1, u = t.length; l < u; l++)
                        i = t[l],
                        r = a,
                        o = (n = i).x - r.x,
                        s = n.y - r.y,
                        e < o * o + s * s && (h.push(i),
                        a = i);
                    return a !== i && h.push(i),
                    h
                }(t, n), n)
            }
            e.exports = t,
            e.exports.default = t
        }()
    })
      , _h = function(n) {
        function t() {
            return n.apply(this, arguments) || this
        }
        it(t, n);
        var e = t.prototype;
        return e.animateShow = function(t, n) {
            var r = this;
            void 0 === t && (t = {}),
            this._showPlayer && this._showPlayer.finish(),
            H(t) && (n = t = {});
            var o = this.getCoordinates();
            if (0 === o.length)
                return this;
            this._animIdx = 0,
            this._animLenSoFar = 0,
            this.show();
            var s = !!this.getShell ? this.getShell().concat(this.getShell()[0]) : o
              , e = this._getProjection()
              , a = e.projectCoords(s, this.options.antiMeridian);
            this._prjAniShowCenter = this._getPrjExtent().getCenter(),
            this._aniShowCenter = e.unproject(this._prjAniShowCenter);
            var h = t.duration || 1e3
              , i = t.easing || "out";
            this.setCoordinates([]);
            var l = 0;
            a.length && (a[0]._distance = 0);
            for (var u = 1; u < a.length; u++) {
                var c = a[u].distanceTo(a[u - 1]);
                a[u]._distance = c,
                l += c
            }
            this._tempCoord = new Rr(0,0),
            this._tempPrjCoord = new dt(0,0);
            var d = this._showPlayer = fh.animate({
                t: h
            }, {
                duration: h,
                easing: i
            }, function(t) {
                if (r.getMap()) {
                    var e = r._drawAnimShowFrame(t.styles.t, h, l, s, a);
                    "finished" === t.state.playState && (delete r._showPlayer,
                    delete r._aniShowCenter,
                    delete r._prjAniShowCenter,
                    delete r._animIdx,
                    delete r._animLenSoFar,
                    delete r._animTailRatio,
                    delete r._tempCoord,
                    delete r._tempPrjCoord,
                    r.setCoordinates(o)),
                    n && n(t, e)
                } else if ("finished" !== d.playState && (d.finish(),
                n)) {
                    var i = r.getCoordinates();
                    n(t, i[i.length - 1])
                }
            }, this);
            return d.play(),
            d
        }
        ,
        e._drawAnimShowFrame = function(t, e, i, n, r) {
            if (0 === t)
                return n[0];
            var o, s, a = t / e * i, h = 0;
            for (o = this._animIdx + 1,
            s = r.length; o < s && (h = r[o]._distance,
            !(this._animLenSoFar + h > a)); o++)
                this._animLenSoFar += h;
            if (this._animIdx = o - 1,
            this._animIdx >= s - 1)
                return this.setCoordinates(n),
                n[n.length - 1];
            var l = this._animIdx
              , u = r[l]
              , c = r[l + 1]
              , d = (a - this._animLenSoFar) / h;
            this._animTailRatio = d;
            var f = u.x + (c.x - u.x) * d
              , g = u.y + (c.y - u.y) * d;
            this._tempPrjCoord.x = f,
            this._tempPrjCoord.y = g;
            var p = this._tempPrjCoord
              , m = n[l]
              , _ = n[l + 1]
              , v = m.x + (_.x - m.x) * d
              , y = m.y + (_.y - m.y) * d;
            this._tempCoord.x = v,
            this._tempCoord.y = y;
            var x = this._tempCoord
              , w = !!this.getShell;
            if (!w && 0 < this.options.smoothness) {
                for (var C = [], b = [], P = 0; P <= this._animIdx; P++)
                    C.push(n[P]),
                    b.push(r[P]);
                C.push(x, x),
                b.push(p, p),
                this.setCoordinates(C),
                this._setPrjCoordinates(b)
            } else {
                var M = n.slice(0, this._animIdx + 1);
                M.push(x);
                var T = r.slice(0, this._animIdx + 1);
                T.push(p),
                w ? (this.setCoordinates([this._aniShowCenter].concat(M)),
                this._setPrjCoordinates([this._prjAniShowCenter].concat(T))) : (this.setCoordinates(M),
                this._setPrjCoordinates(T))
            }
            return x
        }
        ,
        e._getCenterInExtent = function(t, e, i) {
            var n = this.getExtent();
            if (!t.intersects(n))
                return null;
            var r = i(e, t);
            if (0 === r.length)
                return null;
            var o = 0
              , s = 0
              , a = 0;
            r.forEach(function(t) {
                Array.isArray(t) ? t.forEach(function(t) {
                    t.point && (t = t.point),
                    o += t.x,
                    s += t.y,
                    a++
                }) : (t.point && (t = t.point),
                o += t.x,
                s += t.y,
                a++)
            });
            var h = new Rr(o,s)._multi(1 / a);
            return h.count = a,
            h
        }
        ,
        e._getPath2DPoints = function(t, e, i) {
            if (!St(t))
                return [];
            var n = this.getMap()
              , r = !e && this._shouldSimplify()
              , o = this.options.simplifyTolerance * n._getResolution()
              , s = Array.isArray(t[0]);
            if (delete this._simplified,
            r && !s) {
                var a = t.length;
                t = mh(t, o, !1),
                this._simplified = t.length < a
            }
            if (i || (i = n._getResolution()),
            Array.isArray(t)) {
                var h = [];
                if (!Array.isArray(t[0]))
                    return h = Bt(t, "_glPt"),
                    n._prjsToPointsAtRes(t, i, h);
                for (var l = [], u = 0, c = t.length; u < c; u++) {
                    var d = t[u];
                    h = Bt(d, "_glPt");
                    var f = n._prjsToPointsAtRes(d, i, h);
                    l.push(f)
                }
                return l
            }
            return n._prjToPointAtRes(t, i)
        }
        ,
        e._shouldSimplify = function() {
            var t = this.getLayer()
              , e = t.options.enableAltitude;
            return t && t.options.enableSimplify && !e && this.options.enableSimplify && !this._showPlayer
        }
        ,
        e._setPrjCoordinates = function(t) {
            this._prjCoords = t,
            this.onShapeChanged()
        }
        ,
        e._getPrjCoordinates = function() {
            return this._verifyProjection(),
            !this._prjCoords && this._getProjection() && (this._prjCoords = this._projectCoords(this._coordinates)),
            this._prjCoords
        }
        ,
        e._updateCache = function() {
            this._clearCache(),
            this._getProjection() && this._prjCoords && (this._coordinates = this._unprojectCoords(this._getPrjCoordinates()))
        }
        ,
        e._clearProjection = function() {
            this._prjCoords = null,
            n.prototype._clearProjection.call(this)
        }
        ,
        e._projectCoords = function(t) {
            var e = this._getProjection();
            return e ? e.projectCoords(t, this.options.antiMeridian) : []
        }
        ,
        e._unprojectCoords = function(t) {
            var e = this._getProjection();
            return e ? e.unprojectCoords(t) : []
        }
        ,
        e._computeCenter = function() {
            var t = this._coordinates;
            if (!St(t))
                return null;
            for (var e = 0, i = 0, n = 0, r = t.length, o = 0; o < r; o++)
                t[o] && G(t[o].x) && G(t[o].y) && (e += t[o].x,
                i += t[o].y,
                n++);
            return new Rr(e / n,i / n)
        }
        ,
        e._computeExtent = function() {
            var t = this._coordinates;
            if (!St(t))
                return null;
            var e = [t];
            return this.hasHoles && this.hasHoles() && e.push.apply(e, this.getHoles()),
            this._coords2Extent(e, this._getProjection())
        }
        ,
        e._computePrjExtent = function() {
            var t = [this._getPrjCoordinates()];
            return this.hasHoles && this.hasHoles() && t.push.apply(t, this._getPrjHoles()),
            this._coords2Extent(t)
        }
        ,
        e._get2DLength = function() {
            for (var t = this._getPath2DPoints(this._getPrjCoordinates(), !0), e = 0, i = 1, n = t.length; i < n; i++)
                e += t[i].distanceTo(t[i - 1]);
            return e
        }
        ,
        e._hitTestTolerance = function() {
            var t, e = this._getInternalSymbol();
            if (Array.isArray(e))
                for (var i = t = 0; i < e.length; i++)
                    G(e[i].lineWidth) && e[i].lineWidth > t && (t = e[i].lineWidth);
            else
                t = e.lineWidth;
            return n.prototype._hitTestTolerance.call(this) + (G(t) ? t / 2 : 1.5)
        }
        ,
        e._coords2Extent = function(t, e) {
            if (!t || 0 === t.length || Array.isArray(t[0]) && 0 === t[0].length)
                return null;
            for (var i = new Zr(e), n = 0, r = t.length; n < r; n++)
                for (var o = 0, s = t[n].length; o < s; o++)
                    i._combine(t[n][o]);
            return i
        }
        ,
        t
    }(sa);
    _h.mergeOptions({
        smoothness: 0,
        enableClip: !0,
        enableSimplify: !0,
        simplifyTolerance: 2,
        symbol: {
            lineColor: "#000",
            lineWidth: 2,
            lineOpacity: 1,
            polygonFill: "#fff",
            polygonOpacity: 1,
            opacity: 1
        }
    });
    var vh = "Polygon"
      , yh = function(n) {
        function t(t, e) {
            var i;
            return (i = n.call(this, e) || this).type = "Polygon",
            t && i.setCoordinates(t),
            i
        }
        it(t, n);
        var e = t.prototype;
        return e.getOutline = function() {
            return this._getPainter() ? new t(this.getExtent().toArray(),{
                symbol: {
                    lineWidth: 1,
                    lineColor: "6b707b"
                }
            }) : null
        }
        ,
        e.setCoordinates = function(t) {
            if (!t)
                return this._coordinates = null,
                this._holes = null,
                this._projectRings(),
                this;
            var e = Rr.toCoordinates(t)
              , i = e.length;
            if (Array.isArray(e[0]))
                if (this._coordinates = this._trimRing(e[0]),
                1 < i) {
                    for (var n = [], r = 1; r < i; r++)
                        e[r] && n.push(this._trimRing(e[r]));
                    this._holes = n
                } else
                    this._holes = null;
            else
                this._coordinates = this._trimRing(e);
            return this._projectRings(),
            this
        }
        ,
        e.getCoordinates = function() {
            if (!this._coordinates)
                return [];
            for (var t = this.getHoles(), e = [this._copyAndCloseRing(this._coordinates)], i = 0, n = t.length; i < n; i++)
                e.push(this._copyAndCloseRing(t[i]));
            return e
        }
        ,
        e.getCenterInExtent = function(t) {
            return this._getCenterInExtent(t, this.getShell(), cs)
        }
        ,
        e.getShell = function() {
            return this._coordinates || []
        }
        ,
        e.getHoles = function() {
            return this._holes || []
        }
        ,
        e.hasHoles = function() {
            return 0 < this.getHoles().length
        }
        ,
        e._projectRings = function() {
            this.getMap() && (this._prjCoords = this._projectCoords(this._coordinates),
            this._prjHoles = this._projectCoords(this._holes)),
            this.onShapeChanged()
        }
        ,
        e._setPrjCoordinates = function(t) {
            this._prjCoords = t,
            this.onShapeChanged()
        }
        ,
        e._cleanRing = function(t) {
            for (var e = t.length - 1; 0 <= e; e--)
                t[e] || t.splice(e, 1)
        }
        ,
        e._checkRing = function(t) {
            if (this._cleanRing(t),
            !t || !St(t))
                return !1;
            var e = t[t.length - 1]
              , i = !0;
            return t[0].x === e.x && t[0].y === e.y || (i = !1),
            i
        }
        ,
        e._trimRing = function(t) {
            var e = this._checkRing(t);
            return St(t) && e && t.splice(t.length - 1, 1),
            t
        }
        ,
        e._copyAndCloseRing = function(t) {
            t = t.slice(0);
            var e = this._checkRing(t);
            return St(t) && !e && t.push(t[0].copy()),
            t
        }
        ,
        e._getPrjShell = function() {
            return this.getJSONType() === vh ? this._getPrjCoordinates() : (this._verifyProjection(),
            this._getProjection() && !this._prjShell && (this._prjShell = this._projectCoords(this._getShell ? this._getShell() : this.getShell())),
            this._prjShell)
        }
        ,
        e._getPrjHoles = function() {
            var t = this._getProjection();
            return this._verifyProjection(),
            t && !this._prjHoles && (this._prjHoles = this._projectCoords(this.getHoles())),
            this._prjHoles
        }
        ,
        e._computeGeodesicLength = function(t) {
            var e = this.getCoordinates();
            if (!St(e))
                return 0;
            for (var i = 0, n = 0, r = e.length; n < r; n++)
                i += t.measureLength(e[n]);
            return i
        }
        ,
        e._computeGeodesicArea = function(t) {
            var e = this.getCoordinates();
            if (!St(e))
                return 0;
            for (var i = t.measureArea(e[0]), n = 1, r = e.length; n < r; n++)
                i -= t.measureArea(e[n]);
            return i
        }
        ,
        e._updateCache = function() {
            n.prototype._updateCache.call(this),
            this._prjHoles && (this._holes = this._unprojectCoords(this._getPrjHoles()))
        }
        ,
        e._clearCache = function() {
            return delete this._prjShell,
            n.prototype._clearCache.call(this)
        }
        ,
        e._clearProjection = function() {
            this._prjHoles && (this._prjHoles = null),
            this._prjShell && (this._prjShell = null),
            n.prototype._clearProjection.call(this)
        }
        ,
        t
    }(_h);
    function xh(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            it(e, t);
            var i = e.prototype;
            return i.getCoordinates = function() {
                return this._coordinates
            }
            ,
            i.setCoordinates = function(t) {
                var e = t instanceof Rr ? t : new Rr(t);
                if (this._coordinates = e,
                !this.getMap())
                    return this._dirtyCoords = !0,
                    this.onPositionChanged(),
                    this;
                var i = this._getProjection();
                return this._setPrjCoordinates(i.project(this._coordinates)),
                this
            }
            ,
            i._getCenter2DPoint = function(t) {
                var e = this.getMap();
                if (!e)
                    return null;
                var i = this._getPrjCoordinates();
                return i ? (t || (t = e._getResolution()),
                e._prjToPointAtRes(i, t)) : null
            }
            ,
            i._getPrjCoordinates = function() {
                var t = this._getProjection();
                return this._verifyProjection(),
                !this._pcenter && t && this._coordinates && (this._pcenter = t.project(this._coordinates)),
                this._pcenter
            }
            ,
            i._setPrjCoordinates = function(t) {
                this._pcenter = t,
                this.onPositionChanged()
            }
            ,
            i._updateCache = function() {
                this._clearCache();
                var t = this._getProjection();
                this._pcenter && t && (this._coordinates = t.unproject(this._pcenter))
            }
            ,
            i._clearProjection = function() {
                this._pcenter = null,
                t.prototype._clearProjection.call(this)
            }
            ,
            i._computeCenter = function() {
                return this._coordinates ? this._coordinates.copy() : null
            }
            ,
            e
        }(t)
    }
    yh.registerJSONType(vh);
    var wh = new Vr
      , Ch = function(r) {
        function n(t, e) {
            var i;
            return (i = r.call(this, e) || this).type = "Point",
            i.isPoint = !0,
            t && i.setCoordinates(t),
            i
        }
        it(n, r);
        var t = n.prototype;
        return t.getOutline = function() {
            var t = this.getCoordinates()
              , e = this.getContainerExtent()
              , i = this.getMap().coordToContainerPoint(t);
            return new n(t,{
                symbol: {
                    markerType: "square",
                    markerWidth: e.getWidth(),
                    markerHeight: e.getHeight(),
                    markerLineWidth: 1,
                    markerLineColor: "6b707b",
                    markerFill: "rgba(0, 0, 0, 0)",
                    markerDx: e.xmin - (i.x - e.getWidth() / 2),
                    markerDy: e.ymin - (i.y - e.getHeight() / 2)
                }
            })
        }
        ,
        t.setSymbol = function() {
            var t;
            delete this._fixedExtent;
            for (var e = arguments.length, i = new Array(e), n = 0; n < e; n++)
                i[n] = arguments[n];
            return (t = r.prototype.setSymbol).call.apply(t, [this].concat(i))
        }
        ,
        t._getSizeSymbol = function(t) {
            for (var e, i = {}, n = !1, r = !1, o = 0; o < ss.length; o++) {
                var s = t[ss[o]];
                ut(s) || (!n && ne(s) && (r = n = !0),
                i[ss[o]] = s)
            }
            for (var a = 0; a < as.length; a++) {
                var h = t[as[a]];
                ut(h) || (!n && ne(h) && (n = !0),
                i[as[a]] = h)
            }
            return n ? (e = Me(i, this),
            r && (e._dynamic = !0)) : e = i,
            e
        }
        ,
        t._setExternSymbol = function(t) {
            return this._symbol || delete this._fixedExtent,
            r.prototype._setExternSymbol.call(this, t)
        }
        ,
        t._isDynamicSize = function() {
            return this._sizeSymbol && this._sizeSymbol._dynamic
        }
        ,
        t._getFixedExtent = function() {
            if (this._fixedExtent && !this._isDynamicSize())
                return this._fixedExtent;
            this._fixedExtent = this._fixedExtent || new Vr,
            this._fixedExtent.set(null, null, null, null);
            var t = this._sizeSymbol;
            if (!t)
                return this._fixedExtent;
            var e = this.getLayer() && this.getLayer().getRenderer()
              , i = e && e.resources
              , n = this.getTextDesc();
            if (Array.isArray(t)) {
                wh.set(1 / 0, 1 / 0, -1 / 0, -1 / 0);
                for (var r = 0; r < t.length; r++)
                    t[r] && this._fixedExtent._combine(ts(wh, t[r], i, n && n[r]))
            } else
                this._fixedExtent = ts(this._fixedExtent, t, i, n);
            return this._fixedExtent
        }
        ,
        t._isVectorMarker = function() {
            var t = this._getInternalSymbol();
            return !Array.isArray(t) && ns(t)
        }
        ,
        t._canEdit = function() {
            var t = this._getInternalSymbol();
            return !Array.isArray(t) && (ns(t) || rs(t) || is(t))
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this.getContainerExtent();
            return e && (i = i.expand(e)),
            !!i.contains(t) && (!this.options.hitTestForEvent || r.prototype._containsPoint.call(this, t, e))
        }
        ,
        t._computeExtent = function() {
            return bh.call(this, "getCenter")
        }
        ,
        t._computePrjExtent = function() {
            return bh.call(this, "_getPrjCoordinates")
        }
        ,
        t._computeGeodesicLength = function() {
            return 0
        }
        ,
        t._computeGeodesicArea = function() {
            return 0
        }
        ,
        t._getSprite = function(t, e) {
            return this._getPainter() ? this._getPainter().getSprite(t, e) : new Ks(this).getSprite(t, e)
        }
        ,
        n
    }(xh(sa));
    function bh(t) {
        var e = this[t]();
        return e ? new Zr(e,e,this._getProjection()) : null
    }
    Ch.mergeOptions({
        symbol: {
            markerType: "path",
            markerPath: [{
                path: "M8 23l0 0 0 0 0 0 0 0 0 0c-4,-5 -8,-10 -8,-14 0,-5 4,-9 8,-9l0 0 0 0c4,0 8,4 8,9 0,4 -4,9 -8,14z M3,9 a5,5 0,1,0,0,-0.9Z",
                fill: "#DE3333"
            }],
            markerPathWidth: 16,
            markerPathHeight: 23,
            markerWidth: 24,
            markerHeight: 34
        },
        hitTestForEvent: !1,
        collision: !0
    }),
    Ch.registerJSONType("Marker");
    var Ph = function(n) {
        function t(t, e) {
            var i;
            return (i = n.call(this, e) || this).type = "LineString",
            t && i.setCoordinates(t),
            i
        }
        it(t, n);
        var e = t.prototype;
        return e.getOutline = function() {
            return yh.prototype.getOutline.call(this)
        }
        ,
        e.setCoordinates = function(t) {
            return t ? (this._coordinates = Rr.toCoordinates(t),
            this.getMap() ? this._setPrjCoordinates(this._projectCoords(this._coordinates)) : this.onShapeChanged()) : (this._coordinates = null,
            this._setPrjCoordinates(null)),
            this
        }
        ,
        e.getCoordinates = function() {
            return this._coordinates || []
        }
        ,
        e.getCenterInExtent = function(t) {
            return this._getCenterInExtent(t, this.getCoordinates(), ls)
        }
        ,
        e._computeGeodesicLength = function(t) {
            return t.measureLength(this.getCoordinates())
        }
        ,
        e._computeGeodesicArea = function() {
            return 0
        }
        ,
        t
    }(_h);
    Ph.mergeOptions({
        arrowStyle: null,
        arrowPlacement: "vertex-last"
    }),
    Ph.registerJSONType("LineString");
    var Mh = new Vr
      , Th = function(n) {
        function e(t, e) {
            var i;
            return (i = n.call(this, e) || this).type = "GeometryCollection",
            i.setGeometries(t),
            i
        }
        it(e, n);
        var t = e.prototype;
        return t.getContainerExtent = function(t) {
            var e = t || new Vr;
            return this.forEach(function(t) {
                e._combine(t.getContainerExtent(Mh))
            }),
            e
        }
        ,
        t.setGeometries = function(t) {
            for (var e = this._checkGeometries(t || []), i = this._getSymbol(), n = this.config(), r = this.getProperties(), o = e.length - 1; 0 <= o; o--)
                e[o]._initOptions(n),
                e[o]._setParent(this),
                e[o]._setEventParent(this),
                i && e[o].setSymbol(i),
                r && e[o].setProperties(r);
            return this._geometries = e,
            this.getLayer() && (this._bindGeometriesToLayer(),
            this.onShapeChanged()),
            this
        }
        ,
        t.getGeometries = function() {
            return this._geometries || []
        }
        ,
        t.forEach = function(t, e) {
            for (var i = this.getGeometries(), n = 0, r = i.length; n < r; n++)
                i[n] && (e ? t.call(e, i[n], n) : t(i[n], n));
            return this
        }
        ,
        t.filter = function(t, i) {
            if (!t)
                return new e;
            var n = []
              , r = H(t)
              , o = r ? t : ue(t);
            return this.forEach(function(t) {
                var e = r ? t : xe(t);
                (i ? o.call(i, e) : o(e)) && n.push(t)
            }, this),
            new e(n)
        }
        ,
        t.translate = function(t) {
            if (!t)
                return this;
            if (this.isEmpty())
                return this;
            var e = arguments;
            return this.forEach(function(t) {
                t && t.translate && t.translate.apply(t, e)
            }),
            this
        }
        ,
        t.isEmpty = function() {
            return !St(this.getGeometries())
        }
        ,
        t.remove = function() {
            return this.forEach(function(t) {
                t._unbind()
            }),
            sa.prototype.remove.apply(this, arguments)
        }
        ,
        t.show = function() {
            return this.options.visible = !0,
            this.forEach(function(t) {
                t.show()
            }),
            this
        }
        ,
        t.hide = function() {
            return this.options.visible = !1,
            this.forEach(function(t) {
                t.hide()
            }),
            this
        }
        ,
        t.onConfig = function(e) {
            this.forEach(function(t) {
                t.config(e)
            })
        }
        ,
        t.getSymbol = function() {
            var t = n.prototype.getSymbol.call(this);
            if (!t) {
                var e = []
                  , i = !1;
                this.forEach(function(t) {
                    t.getSymbol() && !i && (i = !0),
                    e.push(t.getSymbol())
                }),
                i && (t = {
                    children: e
                })
            }
            return t
        }
        ,
        t.setSymbol = function(i) {
            var n = this;
            if (i && i.children)
                this._symbol = null,
                this.forEach(function(t, e) {
                    t._eventSymbolProperties = n._eventSymbolProperties,
                    t.setSymbol(i.children[e])
                });
            else {
                var e = this._prepareSymbol(i);
                this._symbol = e,
                this.forEach(function(t) {
                    t._eventSymbolProperties = n._eventSymbolProperties,
                    t.setSymbol(e)
                })
            }
            return this.onSymbolChanged(),
            this
        }
        ,
        t._setExternSymbol = function(e) {
            return e = this._prepareSymbol(e),
            this._externSymbol = e,
            this.forEach(function(t) {
                t._setExternSymbol(e)
            }),
            this.onSymbolChanged(),
            this
        }
        ,
        t._bindLayer = function() {
            n.prototype._bindLayer.apply(this, arguments),
            this._bindGeometriesToLayer()
        }
        ,
        t._bindGeometriesToLayer = function() {
            var e = this.getLayer();
            this.forEach(function(t) {
                t._bindLayer(e)
            })
        }
        ,
        t._checkGeometries = function(t) {
            for (var e = [], i = 0, n = (t = Array.isArray(t) ? t : [t]).length; i < n; i++) {
                var r = t[i];
                r && (this._checkGeo(r) ? r instanceof Th ? y.isTest || console.error(r, " is GeometryCollection sub class,it Cannot be placed in GeometryCollection") : e.push(r) : console.error("The geometry added to collection is invalid. Index: " + i))
            }
            return e
        }
        ,
        t._checkGeo = function(t) {
            return t instanceof sa
        }
        ,
        t._updateCache = function() {
            this._clearCache(),
            this.isEmpty() || this.forEach(function(t) {
                t && t._updateCache && t._updateCache()
            })
        }
        ,
        t._removePainter = function() {
            this._painter && this._painter.remove(),
            delete this._painter,
            this.forEach(function(t) {
                t._removePainter()
            })
        }
        ,
        t._computeCenter = function(t) {
            if (!t || this.isEmpty())
                return null;
            for (var e = 0, i = 0, n = 0, r = this.getGeometries(), o = 0, s = r.length; o < s; o++)
                if (r[o]) {
                    var a = r[o]._computeCenter(t);
                    a && (e += a.x,
                    i += a.y,
                    n++)
                }
            return 0 === n ? null : new Rr(e / n,i / n)
        }
        ,
        t._containsPoint = function(t, e) {
            if (this.isEmpty())
                return !1;
            delete this._pickGeometryIndex;
            for (var i = this.getGeometries(), n = 0, r = i.length; n < r; n++)
                if (i[n]._containsPoint(t, e))
                    return this._pickGeometryIndex = n,
                    !0;
            return !1
        }
        ,
        t._hitTestTolerance = function() {
            for (var t = this.getGeometries(), e = 0, i = 0, n = t.length; i < n; i++) {
                var r = t[i]._hitTestTolerance();
                e = Math.max(e, r)
            }
            return e
        }
        ,
        t._computeExtent = function(t) {
            return Sh.call(this, t, "_computeExtent")
        }
        ,
        t._computePrjExtent = function(t) {
            return Sh.call(this, t, "_computePrjExtent")
        }
        ,
        t._computeGeodesicLength = function(t) {
            if (!t || this.isEmpty())
                return 0;
            for (var e = this.getGeometries(), i = 0, n = 0, r = e.length; n < r; n++)
                e[n] && (i += e[n]._computeGeodesicLength(t));
            return i
        }
        ,
        t._computeGeodesicArea = function(t) {
            if (!t || this.isEmpty())
                return 0;
            for (var e = this.getGeometries(), i = 0, n = 0, r = e.length; n < r; n++)
                e[n] && (i += e[n]._computeGeodesicArea(t));
            return i
        }
        ,
        t._exportGeoJSONGeometry = function() {
            var t = [];
            if (!this.isEmpty())
                for (var e = this.getGeometries(), i = 0, n = e.length; i < n; i++)
                    e[i] && t.push(e[i]._exportGeoJSONGeometry());
            return {
                type: "GeometryCollection",
                geometries: t
            }
        }
        ,
        t._toJSON = function(t) {
            t = F({}, t);
            var e, i = {
                type: "Feature",
                geometry: {
                    type: "GeometryCollection",
                    geometries: this.getGeometries().filter(function(t) {
                        return t && t._toJSON
                    }).map(function(t) {
                        var e = t._toJSON();
                        return e.subType ? e : t._exportGeoJSONGeometry()
                    })
                }
            }, n = this.getId();
            return ut(n) || (i.id = n),
            (ut(t.properties) || t.properties) && (e = this._exportProperties()),
            i.properties = e,
            t.feature = i,
            t
        }
        ,
        t._clearProjection = function() {
            if (!this.isEmpty())
                for (var t = this.getGeometries(), e = 0, i = t.length; e < i; e++)
                    t[e] && t[e]._clearProjection()
        }
        ,
        t._getConnectPoints = function() {
            var t = this.getExtent();
            return [new Rr(t.xmin,t.ymax), new Rr(t.xmax,t.ymin), new Rr(t.xmin,t.ymin), new Rr(t.xmax,t.ymax)]
        }
        ,
        t._getExternalResources = function() {
            if (this.isEmpty())
                return [];
            for (var t, e, i = this.getGeometries(), n = [], r = {}, o = 0, s = i.length; o < s; o++)
                if (i[o])
                    for (var a = 0, h = (t = Re(i[o]._getInternalSymbol())).length; a < h; a++)
                        r[e = t[a].join()] || (n.push(t[a]),
                        r[e] = 1);
            return n
        }
        ,
        t.startEdit = function(t) {
            var e = this;
            if (this.isEmpty())
                return this;
            t || (t = {}),
            t.symbol && (this._originalSymbol = this.getSymbol(),
            this.setSymbol(t.symbol)),
            this._draggbleBeforeEdit = this.options.draggable,
            this.config("draggable", !1);
            for (var i = this.getGeometries(), n = 0, r = i.length; n < r; n++)
                i[n].startEdit(t);
            this._editing = !0;
            var o = this.getLayer();
            return o && "canvas" === o.options.renderer && this.hide(),
            setTimeout(function() {
                e.fire("editstart")
            }, 1),
            this
        }
        ,
        t.endEdit = function() {
            if (this.isEmpty())
                return this;
            for (var t = this.getGeometries(), e = 0, i = t.length; e < i; e++)
                t[e].endEdit();
            return this._originalSymbol && (this.setSymbol(this._originalSymbol),
            delete this._originalSymbol),
            this._editing = !1,
            this.show(),
            this.config("draggable", this._draggbleBeforeEdit),
            this.fire("editend"),
            this
        }
        ,
        t.isEditing = function() {
            return !!this._editing
        }
        ,
        e
    }(sa);
    function Sh(t, e) {
        if (this.isEmpty())
            return null;
        for (var i = new Zr, n = this.getGeometries(), r = 0, o = n.length; r < o; r++)
            if (n[r]) {
                var s = n[r][e](t);
                s && i._combine(s)
            }
        return i
    }
    Th.registerJSONType("GeometryCollection");
    var Eh = function(o) {
        function t(t, e, i, n) {
            var r;
            return (r = o.call(this, null, n) || this).GeometryType = t,
            r.type = e,
            r._initData(i),
            r
        }
        it(t, o);
        var e = t.prototype;
        return e.getCoordinates = function() {
            for (var t = [], e = this.getGeometries(), i = 0, n = e.length; i < n; i++) {
                var r = e[i];
                t.push(r.getShell && "Polygon" !== r.getJSONType() ? [r.getShell()] : r.getCoordinates())
            }
            return t
        }
        ,
        e.setCoordinates = function(t) {
            for (var e = [], i = 0, n = (t = t || []).length; i < n; i++) {
                var r = new this.GeometryType(t[i],this.config());
                e.push(r)
            }
            return this.setGeometries(e),
            this
        }
        ,
        e._initData = function(t) {
            (t = t || []).length && (t[0]instanceof this.GeometryType ? this.setGeometries(t) : this.setCoordinates(t))
        }
        ,
        e._checkGeo = function(t) {
            return t instanceof this.GeometryType
        }
        ,
        e._exportGeoJSONGeometry = function() {
            var t = this.getCoordinates()
              , e = Rr.toNumberArrays(t);
            return {
                type: this.getType(),
                coordinates: e
            }
        }
        ,
        e._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t)
            }
        }
        ,
        t
    }(Th)
      , Rh = function(i) {
        function t(t, e) {
            return i.call(this, Ch, "MultiPoint", t, e) || this
        }
        return it(t, i),
        t.prototype.findClosest = function(s) {
            if (!s)
                return null;
            var t = this.getCoordinates()
              , a = null
              , h = 1 / 0;
            return t.forEach(function(t) {
                var e, i, n, r, o = (e = t,
                n = (i = s).x - e.x,
                r = i.y - e.y,
                Math.sqrt(n * n + r * r));
                o < h && (a = t,
                h = o)
            }),
            a
        }
        ,
        t
    }(Eh);
    Rh.registerJSONType("MultiPoint");
    var Ah = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        return it(e, t),
        e.prototype.getCenterInExtent = function(i) {
            var t = this.getGeometries()
              , n = 0
              , r = 0
              , o = 0;
            return t.forEach(function(t) {
                var e = t.getCenterInExtent(i);
                e && (n += e.x * e.count,
                r += e.y * e.count,
                o += e.count)
            }),
            0 === o ? null : new Rr(n,r)._multi(1 / o)
        }
        ,
        e
    }(Eh)
      , kh = function(i) {
        function t(t, e) {
            return i.call(this, Ph, "MultiLineString", t, e) || this
        }
        return it(t, i),
        t
    }(Ah);
    kh.registerJSONType("MultiLineString");
    var Oh = function(i) {
        function t(t, e) {
            return i.call(this, yh, "MultiPolygon", t, e) || this
        }
        return it(t, i),
        t
    }(Ah);
    Oh.registerJSONType("MultiPolygon");
    var Lh, Dh = {
        Marker: Ch,
        LineString: Ph,
        Polygon: yh,
        MultiPoint: Rh,
        MultiLineString: kh,
        MultiPolygon: Oh
    }, Ih = "geojson-fetch-worker-page-async", zh = function(t) {
        function e() {
            return t.call(this, Ih) || this
        }
        it(e, t);
        var i = e.prototype;
        return i._sendMsg = function(i, n, r) {
            var o = this;
            this.send(i, [], function(t, e) {
                t ? r(t) : o._pageFeatures(i, e, n, r)
            }, i.workerId)
        }
        ,
        i._fetchGeoJSON = function(t, e, i, n) {
            void 0 === i && (i = []);
            var r = F({}, e);
            r.type = "fetchdata",
            r.url = t,
            this._sendMsg(r, i, n)
        }
        ,
        i._pageFeatures = function(t, e, i, n) {
            if (i.push(e),
            0 !== e.length) {
                var r = F({}, t);
                r.type = "pagefeatures",
                this._sendMsg(r, i, n)
            } else
                n(null, i)
        }
        ,
        e
    }(Oo);
    Qi(Ih, function() {
        return "\nfunction (exports) {\n    const resultMap = {};\n\n    function handleResult(msg, postResponse) {\n        const data = msg.data || {};\n        const { taskId } = data;\n        const features = resultMap[taskId];\n        if (!features) {\n            postResponse('not find geojson dataset the taskId:' + taskId);\n            return;\n        }\n        if (features.length === 0) {\n            delete resultMap[taskId];\n            postResponse(null, []);\n            return;\n        }\n        const pageSize = data.pageSize || 2000;\n        const pageFeatures = features.slice(0, pageSize);\n        resultMap[taskId] = features.slice(pageSize, Infinity);\n        postResponse(null, pageFeatures);\n    }\n    //worker init\n    exports.initialize = function () {\n        // console.log(\"geojson fetch init\");\n    };\n    //recive message\n    exports.onmessage = function (msg, postResponse) {\n        const { taskId, type, url } = msg.data || {};\n        if (!taskId) {\n            postResponse('not find task id for get geojson dataset,taskId=' + taskId);\n            return;\n        }\n        if (type === 'fetchdata') {\n            if (!url) {\n                postResponse('url is null,url=' + url);\n                return;\n            }\n            fetch(url).then(res => res.json()).then(geojson => {\n                let features;\n                if (Array.isArray(geojson)) {\n                    features = geojson;\n                } else if (geojson.features) {\n                    features = geojson.features;\n                } else {\n                    features = [geojson];\n                }\n                resultMap[taskId] = features;\n                handleResult(msg, postResponse);\n            }).catch(errror => {\n                postResponse(errror.message);\n            });\n        } else if (type === 'pagefeatures') {\n            handleResult(msg, postResponse);\n        } else {\n            postResponse('not support task type:' + type);\n        }\n    };\n}"
    });
    var jh = {
        toGeometry: function(t, e) {
            if (P(t) && (t = vt(t)),
            Array.isArray(t)) {
                for (var i = [], n = 0, r = t.length; n < r; n++) {
                    var o = jh._convert(t[n], e);
                    Array.isArray(o) ? yt(i, o) : i.push(o)
                }
                return i
            }
            return jh._convert(t, e)
        },
        toGeometryAsync: function(i, l, n) {
            return void 0 === n && (n = 2e3),
            P(i) && (i = vt(i)),
            new Wi(function(r) {
                var o = [];
                if (i && (Array.isArray(i) || Array.isArray(i.features))) {
                    var s = G(n) ? Math.round(n) : 2e3
                      , a = i.features || i
                      , t = Math.ceil(a.length / s)
                      , h = 1;
                    cn({
                        count: t,
                        run: function() {
                            var t = (h - 1) * s
                              , e = h * s
                              , i = a.slice(t, e)
                              , n = jh.toGeometry(i, l);
                            return h++,
                            n
                        }
                    }).then(function(t) {
                        for (var e = 0, i = t.length; e < i; e++) {
                            var n = t[e];
                            n && (Array.isArray(n) ? yt(o, n) : o.push(n))
                        }
                        r(o)
                    })
                } else {
                    var e = jh.toGeometry(i, l);
                    r(e)
                }
            }
            )
        },
        _convert: function(t, e) {
            if (!t || ut(t.type))
                return null;
            var i = t.type;
            if ("Feature" === i) {
                var n = t.geometry
                  , r = jh._convert(n);
                return r ? (r.setId(t.id),
                r.setProperties(t.properties),
                e && e(r),
                r) : null
            }
            if ("FeatureCollection" === i) {
                var o = t.features;
                return o ? jh.toGeometry(o, e) : null
            }
            if (0 <= ["Point", "LineString", "Polygon", "MultiPoint", "MultiLineString", "MultiPolygon"].indexOf(i)) {
                var s = new Dh["Point" === i ? "Marker" : i](t.coordinates);
                return e && e(s),
                s
            }
            if ("GeometryCollection" === i) {
                var a = t.geometries;
                if (!St(a)) {
                    var h = new Th;
                    return e && e(h),
                    h
                }
                for (var l = [], u = a.length, c = 0; c < u; c++)
                    a[c].subType ? l.push(sa.getJSONClass(a[c].subType).fromJSON(a[c])) : l.push(jh._convert(a[c]));
                var d = new Th(l);
                return e && e(d),
                d
            }
            return null
        },
        _isGeoJSON: function(t) {
            if (!t)
                return !1;
            if (t = t || {},
            Array.isArray(t) && t.length)
                return jh.isGeoJSON(t[0]);
            var e = t.type;
            if (!e)
                return !1;
            if (-1 === h.indexOf(e))
                return !1;
            var i = t
              , n = i.features
              , r = i.geometries
              , o = i.geometry
              , s = i.coordinates;
            if (s && Array.isArray(s))
                return !0;
            if (Array.isArray(r))
                return !0;
            if (Array.isArray(n))
                return !0;
            if (o) {
                var a = o.coordinates;
                if (a && Array.isArray(a))
                    return !0
            }
            return !1
        },
        fetch: function(o, s) {
            return void 0 === s && (s = 2e3),
            new Wi(function(i, r) {
                if (o && P(o)) {
                    var t = F({
                        pageSize: 2e3
                    }, {
                        pageSize: s
                    });
                    o = Zt(o),
                    Lh || (Lh = new zh);
                    var e = Lh.workers.length
                      , n = Math.floor(Math.random() * e);
                    n = Math.min(e - 1, n),
                    t.workerId = n,
                    t.taskId = _t(),
                    Lh._fetchGeoJSON(o, t, [], function(t, e) {
                        if (t)
                            r(t);
                        else {
                            var n = [];
                            e.forEach(function(t) {
                                for (var e = 0, i = t.length; e < i; e++)
                                    n.push(t[e])
                            }),
                            i({
                                type: "FeatureCollection",
                                features: n
                            })
                        }
                    })
                } else
                    r("url is error,It should be string")
            }
            )
        }
    }
      , Fh = function(s) {
        function n(t, e, i) {
            var n;
            return n = s.call(this, null, i) || this,
            t && n.setCoordinates(t),
            n._radius = e,
            n
        }
        it(n, s),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.coordinates,t.radius,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var t = n.prototype;
        return t.getRadius = function() {
            return this._radius
        }
        ,
        t.setRadius = function(t) {
            return this._radius = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getShell = function() {
            for (var t, e, i, n = this._getMeasurer(), r = this.getCoordinates(), o = this.options.numberOfShellPoints, s = this.getRadius(), a = [], h = 0, l = o - 1; h < l; h++) {
                t = 360 * h / l * Math.PI / 180,
                e = s * Math.cos(t),
                i = s * Math.sin(t);
                var u = n.locate(r, e, i);
                u.z = r.z,
                a.push(u)
            }
            return a.push(a[0]),
            a
        }
        ,
        t.getHoles = function() {
            return []
        }
        ,
        t.animateShow = function() {
            return this.show()
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this.getMap();
            if (i.getPitch())
                return s.prototype._containsPoint.call(this, t, e);
            var n = i._pointToContainerPoint(this._getCenter2DPoint())
              , r = this.getSize()
              , o = this._hitTestTolerance() + (e || 0);
            return gs(t, n, n.add(r.width / 2, r.height / 2), o)
        }
        ,
        t._computePrjExtent = function(e) {
            var t = this._getMinMax(e);
            if (!t)
                return null;
            var i = this._getPrjCoordinates()
              , n = t.map(function(t) {
                return e.project(t)
            })
              , r = n[0].x - i.x
              , o = n[1].x - i.x
              , s = n[2].y - i.y
              , a = n[3].y - i.y;
            return new Zr(i.add(r, s),i.add(o, a))
        }
        ,
        t._computeExtent = function(t) {
            var e = this._getMinMax(t);
            return e ? new Zr(e[0].x,e[2].y,e[1].x,e[3].y,this._getProjection()) : null
        }
        ,
        t._getMinMax = function(t) {
            if (!t || !this._coordinates || ut(this._radius))
                return null;
            var e = this._radius;
            return [t.locate(this._coordinates, -e, 0), t.locate(this._coordinates, e, 0), t.locate(this._coordinates, 0, e), t.locate(this._coordinates, 0, -e)]
        }
        ,
        t._computeGeodesicLength = function() {
            return ut(this._radius) ? 0 : 2 * Math.PI * this._radius
        }
        ,
        t._computeGeodesicArea = function() {
            return ut(this._radius) ? 0 : Math.PI * Math.pow(this._radius, 2)
        }
        ,
        t._exportGeoJSONGeometry = function() {
            return {
                type: "Polygon",
                coordinates: Rr.toNumberArrays([this.getShell()])
            }
        }
        ,
        t._toJSON = function(t) {
            var e = this.getCenter()
              , i = F({}, t);
            i.geometry = !1;
            var n = this.toGeoJSON(i);
            return n.geometry = {
                type: "Polygon"
            },
            {
                feature: n,
                subType: "Circle",
                coordinates: [e.x, e.y],
                radius: this.getRadius()
            }
        }
        ,
        n
    }(xh(yh));
    Fh.mergeOptions({
        numberOfShellPoints: 60
    }),
    Fh.registerJSONType("Circle");
    var Gh = function(s) {
        function n(t, e, i, n) {
            var r;
            return r = s.call(this, null, n) || this,
            t && r.setCoordinates(t),
            r.width = e,
            r.height = i,
            r
        }
        it(n, s),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.coordinates,t.width,t.height,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var t = n.prototype;
        return t.getWidth = function() {
            return this.width
        }
        ,
        t.setWidth = function(t) {
            return this.width = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getHeight = function() {
            return this.height
        }
        ,
        t.setHeight = function(t) {
            return this.height = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getShell = function() {
            return this.isRotated() ? this.getRotatedShell() : this._getShell()
        }
        ,
        t._getShell = function() {
            for (var t, e, i, n, r = this._getMeasurer(), o = this.getCoordinates(), s = this.options.numberOfShellPoints - 1, a = this.getWidth(), h = this.getHeight(), l = [], u = Math.pow(a / 2, 2) * Math.pow(h / 2, 2), c = Math.pow(a / 2, 2), d = Math.pow(h / 2, 2), f = 0; f < s; f++) {
                e = (t = 360 * f / s) * Math.PI / 180,
                i = Math.sqrt(u / (c * Math.pow(Math.tan(e), 2) + d)),
                n = Math.sqrt(u / (d * Math.pow(1 / Math.tan(e), 2) + c)),
                90 < t && t < 270 && (i *= -1),
                180 < t && t < 360 && (n *= -1);
                var g = r.locate(o, i, n);
                g.z = o.z,
                l.push(g)
            }
            return l.push(l[0].copy()),
            l
        }
        ,
        t._getPrjShell = function() {
            var t = s.prototype._getPrjShell.call(this);
            return this._rotatePrjCoordinates(t)
        }
        ,
        t.getHoles = function() {
            return []
        }
        ,
        t.animateShow = function() {
            return this.show()
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this.getMap();
            if (i.isTransforming())
                return s.prototype._containsPoint.call(this, t, e);
            var n = i.getProjection()
              , r = this._hitTestTolerance() + (e || 0)
              , o = n.projectCoords([this._coordinates, i.locate(this._coordinates, this.getWidth() / 2, this.getHeight() / 2)], this.options.antiMeridian);
            return gs(t, i._prjToContainerPoint(o[0]), i._prjToContainerPoint(o[1]), r)
        }
        ,
        t._computePrjExtent = function() {
            return this.isRotated() ? this._computeRotatedPrjExtent() : Fh.prototype._computePrjExtent.apply(this, arguments)
        }
        ,
        t._computeExtent = function() {
            return Fh.prototype._computeExtent.apply(this, arguments)
        }
        ,
        t._getMinMax = function(t) {
            if (!t || !this._coordinates || ut(this.width) || ut(this.height))
                return null;
            var e = this.getWidth()
              , i = this.getHeight();
            return [t.locate(this._coordinates, -e / 2, 0), t.locate(this._coordinates, e / 2, 0), t.locate(this._coordinates, 0, -i / 2), t.locate(this._coordinates, 0, i / 2)]
        }
        ,
        t._computeGeodesicLength = function() {
            if (ut(this.width) || ut(this.height))
                return 0;
            var t = this.width > this.height ? this.width : this.height;
            return 2 * Math.PI * t / 2 - 4 * Math.abs(this.width - this.height)
        }
        ,
        t._computeGeodesicArea = function() {
            return ut(this.width) || ut(this.height) ? 0 : Math.PI * this.width * this.height / 4
        }
        ,
        t._exportGeoJSONGeometry = function() {
            return {
                type: "Polygon",
                coordinates: Rr.toNumberArrays([this.getShell()])
            }
        }
        ,
        t._toJSON = function(t) {
            var e = F({}, t)
              , i = this.getCenter();
            e.geometry = !1;
            var n = this.toGeoJSON(e);
            return n.geometry = {
                type: "Polygon"
            },
            {
                feature: n,
                subType: "Ellipse",
                coordinates: [i.x, i.y],
                width: this.getWidth(),
                height: this.getHeight()
            }
        }
        ,
        n
    }(xh(yh));
    Gh.mergeOptions({
        numberOfShellPoints: 81
    }),
    Gh.registerJSONType("Ellipse");
    var Hh = function(d) {
        function n(t, e, i, n) {
            var r;
            return r = d.call(this, null, n) || this,
            t && r.setCoordinates(t),
            r._width = e,
            r._height = i,
            r
        }
        it(n, d),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.coordinates,t.width,t.height,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var t = n.prototype;
        return t.getCoordinates = function() {
            return this._coordinates
        }
        ,
        t.setCoordinates = function(t) {
            if (this._coordinates = t instanceof Rr ? t : new Rr(t),
            !this._coordinates || !this.getMap())
                return this.onPositionChanged(),
                this;
            var e = this._getProjection();
            return this._setPrjCoordinates(e.project(this._coordinates)),
            this
        }
        ,
        t.getWidth = function() {
            return this._width
        }
        ,
        t.setWidth = function(t) {
            return this._width = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getHeight = function() {
            return this._height
        }
        ,
        t.setHeight = function(t) {
            return this._height = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getShell = function() {
            return this.isRotated() ? this.getRotatedShell() : this._getShell()
        }
        ,
        t._getShell = function() {
            var t = this._getMeasurer()
              , e = this._coordinates
              , i = this.getMap()
              , n = 1
              , r = -1;
            if (i) {
                var o = i.getFullExtent();
                o.left > o.right && (n = -1),
                o.bottom > o.top && (r = 1)
            }
            var s = [];
            s.push(e);
            var a = t.locate(e, n * this._width, 0);
            a.z = e.z,
            s.push(a);
            var h = t.locate(e, n * this._width, r * this._height);
            h.z = e.z,
            s.push(h);
            var l = t.locate(e, 0, r * this._height);
            return s.push(l),
            l.z = e.z,
            s.push(e),
            s
        }
        ,
        t.getHoles = function() {
            return []
        }
        ,
        t.animateShow = function() {
            return this.show()
        }
        ,
        t._getPrjCoordinates = function() {
            var t = this._getProjection();
            return this._verifyProjection(),
            !this._pnw && t && this._coordinates && (this._pnw = t.project(this._coordinates)),
            this._pnw
        }
        ,
        t._setPrjCoordinates = function(t) {
            this._pnw = t,
            this.onPositionChanged()
        }
        ,
        t._getPrjShell = function() {
            var t = d.prototype._getPrjShell.call(this)
              , e = this._getProjection();
            if (!e.isSphere())
                return this._rotatePrjCoordinates(t);
            for (var i = e.getSphereExtent(), n = i.sx, r = i.sy, o = this._getProjection().getCircum(), s = t[0], a = 1, h = t.length; a < h; a++) {
                var l = t[a]
                  , u = 0
                  , c = 0;
                0 < n * (s.x - l.x) && (u = o.x * n),
                r * (s.y - l.y) < 0 && (c = o.y * r),
                t[a]._add(u, c)
            }
            return this._rotatePrjCoordinates(t)
        }
        ,
        t._updateCache = function() {
            this._clearCache();
            var t = this._getProjection();
            this._pnw && t && (this._coordinates = t.unproject(this._pnw))
        }
        ,
        t._clearProjection = function() {
            this._pnw = null,
            d.prototype._clearProjection.call(this)
        }
        ,
        t._computeCenter = function(t) {
            return t.locate(this._coordinates, this._width / 2, -this._height / 2)
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this.getMap();
            if (i.isTransforming())
                return d.prototype._containsPoint.call(this, t, e);
            var n = ut(e) ? this._hitTestTolerance() : e
              , r = i._getResolution() * n
              , o = this._getPrjExtent().expand(r)
              , s = i._containerPointToPrj(t);
            return o.contains(s)
        }
        ,
        t._computePrjExtent = function(t) {
            if (this.isRotated())
                return this._computeRotatedPrjExtent();
            var e = this._getSouthEast(t);
            if (!e)
                return null;
            var i = t.projectCoords([new Rr(this._coordinates.x,e.y), new Rr(e.x,this._coordinates.y)], this.options.antiMeridian);
            return new Zr(i[0],i[1])
        }
        ,
        t._computeExtent = function(t) {
            var e = this._getSouthEast(t);
            return e ? new Zr(this._coordinates,e,this._getProjection()) : null
        }
        ,
        t._getSouthEast = function(t) {
            if (!t || !this._coordinates || ut(this._width) || ut(this._height))
                return null;
            var e = this.getWidth()
              , i = -this.getHeight();
            if (t.fullExtent) {
                var n = t.fullExtent;
                e *= n.right > n.left ? 1 : -1,
                i *= n.top > n.bottom ? 1 : -1
            }
            var r = t.locate(this._coordinates, e, 0)
              , o = t.locate(this._coordinates, 0, i);
            return r.y = o.y,
            r
        }
        ,
        t._computeGeodesicLength = function() {
            return ut(this._width) || ut(this._height) ? 0 : 2 * (this._width + this._height)
        }
        ,
        t._computeGeodesicArea = function() {
            return ut(this._width) || ut(this._height) ? 0 : this._width * this._height
        }
        ,
        t._exportGeoJSONGeometry = function() {
            return {
                type: "Polygon",
                coordinates: Rr.toNumberArrays([this.getShell()])
            }
        }
        ,
        t._toJSON = function(t) {
            var e = F({}, t)
              , i = this.getCoordinates();
            e.geometry = !1;
            var n = this.toGeoJSON(e);
            return n.geometry = {
                type: "Polygon"
            },
            {
                feature: n,
                subType: "Rectangle",
                coordinates: [i.x, i.y],
                width: this.getWidth(),
                height: this.getHeight()
            }
        }
        ,
        n
    }(yh);
    Hh.registerJSONType("Rectangle");
    var Bh = function(p) {
        function n(t, e, i, n, r) {
            var o;
            return (o = p.call(this, t, e, r) || this).startAngle = i,
            o.endAngle = n,
            o
        }
        it(n, p),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.coordinates,t.radius,t.startAngle,t.endAngle,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var t = n.prototype;
        return t.getStartAngle = function() {
            return this.startAngle
        }
        ,
        t.setStartAngle = function(t) {
            return this.startAngle = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getEndAngle = function() {
            return this.endAngle
        }
        ,
        t.setEndAngle = function(t) {
            return this.endAngle = t,
            this.onShapeChanged(),
            this
        }
        ,
        t.getShell = function() {
            return this.isRotated() ? this.getRotatedShell() : this._getShell()
        }
        ,
        t._getShell = function() {
            for (var t, e, i, n = this._getMeasurer(), r = this.getCoordinates(), o = this.options.numberOfShellPoints - 2, s = this.getRadius(), a = [r.copy()], h = this.getStartAngle(), l = this.getEndAngle() - h, u = 0; u < o; u++) {
                t = (l * u / (o - 1) + h) * Math.PI / 180,
                e = s * Math.cos(t),
                i = s * Math.sin(t);
                var c = n.locate(r, e, i);
                c.z = r.z,
                a.push(c)
            }
            return a.push(r.copy()),
            a
        }
        ,
        t.getRotateOffsetAngle = function() {
            return 90
        }
        ,
        t._getPrjShell = function() {
            var t = p.prototype._getPrjShell.call(this);
            return this._rotatePrjCoordinates(t)
        }
        ,
        t._computePrjExtent = function() {
            return this.isRotated() ? this._computeRotatedPrjExtent() : Fh.prototype._computePrjExtent.apply(this, arguments)
        }
        ,
        t._containsPoint = function(t, e) {
            var i = this.getMap();
            if (i.isTransforming())
                return p.prototype._containsPoint.call(this, t, e);
            var n = i._pointToContainerPoint(this._getCenter2DPoint())
              , r = this._hitTestTolerance() + (e || 0)
              , o = this.getSize()
              , s = n
              , a = t
              , h = a.x - s.x
              , l = s.y - a.y
              , u = Math.atan2(l, h)
              , c = u < 0 ? 360 * (u + 2 * Math.PI) / (2 * Math.PI) : 360 * u / (2 * Math.PI)
              , d = this.startAngle % 360
              , f = this.endAngle % 360
              , g = !1;
            return g = f < d ? !(f < c && c < d) : d <= c && c <= f,
            a.distanceTo(s) <= o.width / 2 + r && g
        }
        ,
        t._computeGeodesicLength = function() {
            return ut(this._radius) ? 0 : 2 * Math.PI * this._radius * Math.abs(this.startAngle - this.endAngle) / 360 + 2 * this._radius
        }
        ,
        t._computeGeodesicArea = function() {
            return ut(this._radius) ? 0 : Math.PI * Math.pow(this._radius, 2) * Math.abs(this.startAngle - this.endAngle) / 360
        }
        ,
        t._toJSON = function(t) {
            var e = F({}, t)
              , i = this.getCenter();
            e.geometry = !1;
            var n = this.toGeoJSON(e);
            return n.geometry = {
                type: "Polygon"
            },
            {
                feature: n,
                subType: "Sector",
                coordinates: [i.x, i.y],
                radius: this.getRadius(),
                startAngle: this.getStartAngle(),
                endAngle: this.getEndAngle()
            }
        }
        ,
        n
    }(Fh);
    Bh.mergeOptions({
        numberOfShellPoints: 60
    }),
    Bh.registerJSONType("Sector");
    var Nh = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i._arc = function(t, e, i) {
            for (var n = this.options.arcDegree * Math.PI / 180, r = 1, o = e.length; r < o; r++) {
                var s = Gn._arcBetween(t, e[r - 1], e[r], n)
                  , a = [e[r - 1].x + e[r].x - s[0], e[r - 1].y + e[r].y - s[1]];
                e[r - 1].nextCtrlPoint = a,
                e[r].prevCtrlPoint = a,
                Gn._stroke(t, i)
            }
        }
        ,
        i._quadraticCurve = function(t, e) {
            if (e.length <= 2)
                Gn._path(t, e);
            else {
                var i, n;
                for (i = 2,
                n = e.length; i < n; i += 2)
                    t.quadraticCurveTo(e[i - 1].x, e[i - 1].y, e[i].x, e[i].y);
                if ((i -= 1) < n)
                    for (; i < n; i++)
                        t.lineTo(e[i].x, e[i].y)
            }
        }
        ,
        i._bezierCurve = function(t, e) {
            if (e.length <= 3)
                Gn._path(t, e);
            else {
                var i, n;
                for (i = 1,
                n = e.length; i + 2 < n; i += 3)
                    t.bezierCurveTo(e[i].x, e[i].y, e[i + 1].x, e[i + 1].y, e[i + 2].x, e[i + 2].y);
                if (i < n)
                    for (; i < n; i++)
                        t.lineTo(e[i].x, e[i].y)
            }
        }
        ,
        i._getCurveArrowPoints = function(t, e, i, n, r, o) {
            var s, a = e.length;
            for (s = o; s < a; s += o) {
                var h = this._getArrowShape(e[s - 1], e[s], i, n, r);
                h && t.push(h)
            }
            if ((s -= o) < a - 1)
                for (s += 1; s < a; s++) {
                    var l = this._getArrowShape(e[s - 1], e[s], i, n, r);
                    l && t.push(l)
                }
        }
        ,
        e
    }(Ph);
    Nh.mergeOptions({
        enableSimplify: !1,
        enableClip: !1
    });
    var Zh = function(t) {
        function n() {
            return t.apply(this, arguments) || this
        }
        it(n, t);
        var e = n.prototype;
        return e._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t),
                subType: "ArcCurve"
            }
        }
        ,
        e._paintOn = function(t, e, i) {
            t.beginPath(),
            this._arc(t, e, i),
            Gn._stroke(t, i),
            this._paintArrow(t, e, i)
        }
        ,
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(e.geometry.coordinates,t.options);
            return i.setProperties(e.properties),
            i
        }
        ,
        n
    }(Nh);
    Zh.registerJSONType("ArcCurve"),
    Zh.mergeOptions({
        arcDegree: 90
    });
    var Wh = function(t) {
        function n() {
            return t.apply(this, arguments) || this
        }
        it(n, t),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(e.geometry.coordinates,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var e = n.prototype;
        return e._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t),
                subType: "CubicBezierCurve"
            }
        }
        ,
        e._paintOn = function(t, e, i) {
            t.beginPath(),
            t.moveTo(e[0].x, e[0].y),
            this._bezierCurve(t, e),
            Gn._stroke(t, i),
            this._paintArrow(t, e, i)
        }
        ,
        e._getArrowPoints = function(t, e, i, n, r) {
            return this._getCurveArrowPoints(t, e, i, n, r, 3)
        }
        ,
        n
    }(Nh);
    Wh.registerJSONType("CubicBezierCurve");
    var Vh = function(t) {
        function n() {
            return t.apply(this, arguments) || this
        }
        it(n, t),
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(e.geometry.coordinates,t.options);
            return i.setProperties(e.properties),
            i
        }
        ;
        var e = n.prototype;
        return e._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t),
                subType: "QuadBezierCurve"
            }
        }
        ,
        e._paintOn = function(t, e, i) {
            t.beginPath(),
            t.moveTo(e[0].x, e[0].y),
            this._quadraticCurve(t, e, i),
            Gn._stroke(t, i),
            this._paintArrow(t, e, i)
        }
        ,
        e._getArrowPoints = function(t, e, i, n, r) {
            return this._getCurveArrowPoints(t, e, i, n, r, 2)
        }
        ,
        n
    }(Nh);
    Vh.registerJSONType("QuadBezierCurve");
    var Uh = {
        textFaceName: "monospace",
        textSize: 12,
        textLineSpacing: 8,
        textWrapCharacter: "\n",
        textHorizontalAlignment: "middle",
        textVerticalAlignment: "middle"
    }
      , Jh = {
        markerType: "square",
        markerLineColor: "#000",
        markerLineWidth: 2,
        markerLineOpacity: 1,
        markerFill: "#fff",
        markerOpacity: 1
    }
      , qh = function(r) {
        function t() {
            return r.apply(this, arguments) || this
        }
        it(t, r);
        var e = t.prototype;
        return e.getContent = function() {
            return this._content
        }
        ,
        e.setContent = function(t) {
            var e = this._content;
            return this._content = Ie(t),
            this._refresh(),
            this._fireEvent("contentchange", {
                old: e,
                new: t
            }),
            this
        }
        ,
        e.onAdd = function() {
            this._refresh()
        }
        ,
        e.toJSON = function() {
            var t = r.prototype.toJSON.call(this);
            return delete t.symbol,
            t
        }
        ,
        e.setSymbol = function(t) {
            if (this._refreshing || !t)
                return r.prototype.setSymbol.call(this, t);
            var e = this._parseSymbol(t);
            if (this.setTextStyle) {
                var i = this.getTextStyle() || {};
                i.symbol = e[0],
                this.setTextStyle(i)
            } else
                this.setTextSymbol && this.setTextSymbol(e[0]);
            if (this.setBoxStyle) {
                var n = this.getBoxStyle() || {};
                n.symbol = e[1],
                this.setBoxStyle(n)
            } else
                this.setBoxSymbol && this.setBoxSymbol(e[1]);
            return this
        }
        ,
        e._parseSymbol = function(t) {
            var e = {}
              , i = {};
            for (var n in t)
                v(t, n) && (0 === n.indexOf("text") ? e[n] = t[n] : i[n] = t[n]);
            return [e, i]
        }
        ,
        e._getTextSize = function(t) {
            return qe(this._content, t).size
        }
        ,
        e._getInternalSymbol = function() {
            return this._symbol
        }
        ,
        e._getDefaultTextSymbol = function() {
            return F({}, Uh)
        }
        ,
        e._getDefaultBoxSymbol = function() {
            return F({}, Jh)
        }
        ,
        e._getDefaultPadding = function() {
            return [12, 8]
        }
        ,
        t
    }(Ch)
      , Xh = function(h) {
        function n(t, e, i, n, r) {
            var o;
            return void 0 === r && (r = {}),
            (o = h.call(this, e, r) || this)._content = Ie(t),
            o._width = ut(i) ? 100 : i,
            o._height = ut(n) ? 40 : n,
            r.boxSymbol && o.setBoxSymbol(r.boxSymbol),
            r.textStyle && o.setTextStyle(r.textStyle),
            o._refresh(),
            o
        }
        it(n, h);
        var t = n.prototype;
        return t.getWidth = function() {
            return this._width
        }
        ,
        t.setWidth = function(t) {
            return this._width = t,
            this._refresh(),
            this
        }
        ,
        t.getHeight = function() {
            return this._height
        }
        ,
        t.setHeight = function(t) {
            return this._height = t,
            this._refresh(),
            this
        }
        ,
        t.getBoxSymbol = function() {
            return F({}, this.options.boxSymbol)
        }
        ,
        t.setBoxSymbol = function(t) {
            return this.options.boxSymbol = t ? F({}, t) : t,
            this.getSymbol() && this._refresh(),
            this
        }
        ,
        t.getTextStyle = function() {
            return this.options.textStyle ? F({}, this.options.textStyle) : null
        }
        ,
        t.setTextStyle = function(t) {
            return this.options.textStyle = t ? F({}, t) : t,
            this.getSymbol() && this._refresh(),
            this
        }
        ,
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.content,e.geometry.coordinates,t.width,t.height,t.options);
            return i.setProperties(e.properties),
            i.setId(e.id),
            t.symbol && i.setSymbol(t.symbol),
            i
        }
        ,
        t._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t),
                width: this.getWidth(),
                height: this.getHeight(),
                subType: "TextBox",
                content: this._content
            }
        }
        ,
        t._refresh = function() {
            var t, e, i = this.getTextStyle() || {}, n = i.padding || [12, 8];
            if (ne(this._width)) {
                var r = (t = JSON.parse(JSON.stringify(this._width))).stops;
                if (r)
                    for (var o = 0; o < r.length; o++)
                        r[o][1] = r[o][1] - 2 * n[0]
            } else
                t = this._width - 2 * n[0];
            if (ne(this._height)) {
                var s = (e = JSON.parse(JSON.stringify(this._height))).stops;
                if (s)
                    for (var a = 0; a < s.length; a++)
                        s[a][1] = s[a][1] - 2 * n[1]
            } else
                e = this._height - 2 * n[1];
            var h = F({}, i.symbol || this._getDefaultTextSymbol(), this.options.boxSymbol || this._getDefaultBoxSymbol(), {
                textName: this._content,
                markerWidth: this._width,
                markerHeight: this._height,
                textHorizontalAlignment: "middle",
                textVerticalAlignment: "middle",
                textMaxWidth: t,
                textMaxHeight: e
            });
            i.wrap && !h.textWrapWidth && (h.textWrapWidth = t);
            var l, u = i.horizontalAlignment;
            if (h.textDx = h.markerDx || 0,
            ne(this._width)) {
                var c = (l = JSON.parse(JSON.stringify(this._width))).stops;
                if (c)
                    for (var d = 0; d < c.length; d++)
                        c[d][1] = c[d][1] / 2 - n[0],
                        "left" === u && (c[d][1] *= -1)
            } else
                l = h.markerWidth / 2 - n[0],
                "left" === u && (l *= -1);
            "left" === u ? (h.textHorizontalAlignment = "right",
            h.textDx = l) : "right" === u && (h.textHorizontalAlignment = "left",
            h.textDx = l);
            var f, g = i.verticalAlignment;
            if (h.textDy = h.markerDy || 0,
            ne(this._height)) {
                var p = (f = JSON.parse(JSON.stringify(this._height))).stops;
                if (p)
                    for (var m = 0; m < p.length; m++)
                        p[m][1] = p[m][1] / 2 - n[1],
                        "top" === g && (p[m][1] *= -1)
            } else
                f = h.markerHeight / 2 - n[1],
                "top" === g && (f *= -1);
            "top" === g ? (h.textVerticalAlignment = "bottom",
            h.textDy = f) : "bottom" === g && (h.textVerticalAlignment = "top",
            h.textDy = f),
            this._refreshing = !0,
            this.updateSymbol(h),
            delete this._refreshing
        }
        ,
        t.startEdit = function(t) {
            var e = this._getCompiledSymbol();
            if (ne(this._width)) {
                var i = e.markerWidth;
                this._oldWidth = this._width,
                this.setWidth(i)
            }
            if (ne(this._height)) {
                var n = e.markerHeight;
                this._oldHeight = this._height,
                this.setHeight(n)
            }
            h.prototype.startEdit.call(this, t)
        }
        ,
        t.endEdit = function() {
            var t = this.getMap()
              , e = t && t.getZoom();
            if (this._oldWidth) {
                for (var i = this._width / oe(this._oldWidth)(e), n = this._oldWidth.stops, r = 0; r < n.length; r++)
                    n[r][1] *= i;
                this.setWidth(this._oldWidth),
                delete this._oldWidth
            }
            if (this._oldHeight) {
                for (var o = this._height / oe(this._oldHeight)(e), s = this._oldHeight.stops, a = 0; a < s.length; a++)
                    s[a][1] *= o;
                this.setHeight(this._oldHeight),
                delete this._oldHeight
            }
            h.prototype.endEdit.call(this)
        }
        ,
        n
    }(qh);
    Xh.mergeOptions({
        textStyle: {
            wrap: !0,
            padding: [12, 8],
            verticalAlignment: "middle",
            horizontalAlignment: "middle"
        },
        boxSymbol: null
    }),
    Xh.registerJSONType("TextBox");
    var Yh = function(r) {
        function n(t, e, i) {
            var n;
            return void 0 === i && (i = {}),
            n = r.call(this, e, i) || this,
            i.textSymbol && n.setTextSymbol(i.textSymbol),
            i.boxStyle && n.setBoxStyle(i.boxStyle),
            n._content = Ie(t),
            n._refresh(),
            n
        }
        it(n, r);
        var t = n.prototype;
        return t.getBoxStyle = function() {
            return this.options.boxStyle ? F({}, this.options.boxStyle) : null
        }
        ,
        t.setBoxStyle = function(t) {
            return this.options.boxStyle = t ? F({}, t) : t,
            this._refresh(),
            this
        }
        ,
        t.getTextSymbol = function() {
            return F({}, this._getDefaultTextSymbol(), this.options.textSymbol)
        }
        ,
        t.setTextSymbol = function(t) {
            return this.options.textSymbol = t ? F({}, t) : t,
            this._refresh(),
            this
        }
        ,
        n.fromJSON = function(t) {
            var e = t.feature
              , i = new n(t.content,e.geometry.coordinates,t.options);
            return i.setProperties(e.properties),
            i.setId(e.id),
            t.symbol && i.setSymbol(t.symbol),
            i
        }
        ,
        t._canEdit = function() {
            return !1
        }
        ,
        t._toJSON = function(t) {
            return {
                feature: this.toGeoJSON(t),
                subType: "Label",
                content: this._content
            }
        }
        ,
        t._refresh = function() {
            var t = F({}, this.getTextSymbol(), {
                textName: this._content
            })
              , e = this.getBoxStyle();
            if (e) {
                F(t, e.symbol);
                var i = this._getBoxSize(t)
                  , n = i[1]
                  , r = e.padding || this._getDefaultPadding()
                  , o = i[0];
                t.markerWidth = o.width,
                t.markerHeight = o.height;
                var s = t.textDx || 0
                  , a = t.textDy || 0
                  , h = We(n, t.textHorizontalAlignment, t.textVerticalAlignment)._add(s, a)
                  , l = e.horizontalAlignment || "middle";
                t.markerDx = h.x,
                "left" === l ? t.markerDx += t.markerWidth / 2 - r[0] : "right" === l ? t.markerDx -= t.markerWidth / 2 - n.width - r[0] : t.markerDx += n.width / 2;
                var u = e.verticalAlignment || "middle";
                t.markerDy = h.y,
                "top" === u ? t.markerDy += t.markerHeight / 2 - r[1] : "bottom" === u ? t.markerDy -= t.markerHeight / 2 - n.height - r[1] : t.markerDy += n.height / 2
            }
            this._refreshing = !0,
            this.updateSymbol(t),
            delete this._refreshing
        }
        ,
        t._getBoxSize = function(t) {
            t.markerType || (t.markerType = "square");
            var e, i, n = this.getBoxStyle(), r = this._getTextSize(t), o = n.padding || this._getDefaultPadding();
            return e = r.width + 2 * o[0],
            i = r.height + 2 * o[1],
            n.minWidth && (!e || e < n.minWidth) && (e = n.minWidth),
            n.minHeight && (!i || i < n.minHeight) && (i = n.minHeight),
            [new Oe(e,i), r]
        }
        ,
        n
    }(qh);
    Yh.mergeOptions({
        boxStyle: null,
        textSymbol: null
    }),
    Yh.registerJSONType("Label");
    var Qh = function(t) {
        return function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            it(e, t),
            e._hasConnectors = function(t) {
                return !ut(t.__connectors) && 0 < t.__connectors.length
            }
            ,
            e._getConnectors = function(t) {
                return t.__connectors
            }
            ;
            var i = e.prototype;
            return i.getConnectSource = function() {
                return this._connSource
            }
            ,
            i.setConnectSource = function(t) {
                var e = this._connTarget;
                return this.onRemove(),
                this._connSource = t,
                this._connTarget = e,
                this.onAdd(),
                this
            }
            ,
            i.getConnectTarget = function() {
                return this._connTarget
            }
            ,
            i.setConnectTarget = function(t) {
                var e = this._connSource;
                return this.onRemove(),
                this._connSource = e,
                this._connTarget = t,
                this._updateCoordinates(),
                this._registerEvents(),
                this
            }
            ,
            i._updateCoordinates = function() {
                var t = this.getMap();
                if (!t && this._connSource && (t = this._connSource.getMap()),
                !t && this._connTarget && (t = this._connTarget.getMap()),
                t && this._connSource && this._connTarget) {
                    for (var e, i, n = this._connSource._getConnectPoints(), r = this._connTarget._getConnectPoints(), o = 0, s = this.getCoordinates(), a = 0, h = n.length; a < h; a++)
                        for (var l = n[a], u = 0, c = r.length; u < c; u++) {
                            var d = r[u]
                              , f = t.computeLength(l, d);
                            0 === a && 0 === u ? (e = l,
                            i = d,
                            o = f) : f < o && (e = l,
                            i = d)
                        }
                    St(s) && s[0].equals(e) && s[1].equals(i) || this.setCoordinates([e, i])
                }
            }
            ,
            i.onAdd = function() {
                this._registerEvents(),
                this._updateCoordinates()
            }
            ,
            i.onRemove = function() {
                if (this._connSource && (this._connSource.__connectors && xt(this, this._connSource.__connectors),
                this._connSource.off("dragging positionchange", this._updateCoordinates, this).off("remove", this.onRemove, this),
                this._connSource.off("dragstart mousedown mouseover", this._showConnect, this),
                this._connSource.off("dragend mouseup mouseout", this.hide, this),
                this._connSource.off("show", this._showConnect, this).off("hide", this.hide, this),
                delete this._connSource),
                this._connTarget && (xt(this, this._connTarget.__connectors),
                this._connTarget.off("dragging positionchange", this._updateCoordinates, this).off("remove", this.onRemove, this),
                this._connTarget.off("show", this._showConnect, this).off("hide", this.hide, this),
                delete this._connTarget),
                !(this._connSource instanceof sa && this._connTarget instanceof sa)) {
                    var t = this.getMap();
                    t && t.off("movestart moving moveend zoomstart zooming zoomend rotate pitch fovchange spatialreferencechange", this._updateCoordinates, this)
                }
            }
            ,
            i._showConnect = function() {
                this._connSource && this._connTarget && this._connSource.isVisible() && this._connTarget.isVisible() && (this._updateCoordinates(),
                this.show())
            }
            ,
            i._registerEvents = function() {
                if (this._connSource && this._connTarget) {
                    this._connSource.__connectors || (this._connSource.__connectors = []),
                    this._connTarget.__connectors || (this._connTarget.__connectors = []),
                    this._connSource.__connectors.push(this),
                    this._connTarget.__connectors.push(this),
                    this._connSource.on("dragging positionchange", this._updateCoordinates, this).on("remove", this.remove, this),
                    this._connTarget.on("dragging positionchange", this._updateCoordinates, this).on("remove", this.remove, this),
                    this._connSource.on("show", this._showConnect, this).on("hide", this.hide, this),
                    this._connTarget.on("show", this._showConnect, this).on("hide", this.hide, this);
                    var t = this.options.showOn;
                    if (this.hide(),
                    "moving" === t ? (this._connSource.on("dragstart", this._showConnect, this).on("dragend", this.hide, this),
                    this._connTarget.on("dragstart", this._showConnect, this).on("dragend", this.hide, this)) : "click" === t ? (this._connSource.on("mousedown", this._showConnect, this).on("mouseup", this.hide, this),
                    this._connTarget.on("mousedown", this._showConnect, this).on("mouseup", this.hide, this)) : "mouseover" === t ? (this._connSource.on("mouseover", this._showConnect, this).on("mouseout", this.hide, this),
                    this._connTarget.on("mouseover", this._showConnect, this).on("mouseout", this.hide, this)) : this._showConnect(),
                    !(this._connSource instanceof sa && this._connTarget instanceof sa)) {
                        var e = this.getMap();
                        e && e.on("movestart moving moveend zoomstart zooming zoomend rotate pitch fovchange spatialreferencechange", this._updateCoordinates, this)
                    }
                }
            }
            ,
            e
        }(t)
    }
      , Kh = {
        showOn: "always"
    }
      , $h = function(r) {
        function t(t, e, i) {
            var n;
            return n = r.call(this, null, i) || this,
            1 === arguments.length && (i = t,
            e = t = null),
            n._connSource = t,
            n._connTarget = e,
            n
        }
        return it(t, r),
        t
    }(Qh(Ph));
    $h.mergeOptions(Kh),
    $h.registerJSONType("ConnectorLine");
    var tl = function(r) {
        function t(t, e, i) {
            var n;
            return n = r.call(this, null, i) || this,
            1 === arguments.length && (i = t,
            e = t = null),
            n._connSource = t,
            n._connTarget = e,
            n
        }
        return it(t, r),
        t
    }(Qh(Zh));
    function el(t) {
        return t && t instanceof sa
    }
    tl.mergeOptions(Kh),
    tl.registerJSONType("ArcConnectorLine");
    var il = []
      , nl = function(o) {
        function t(t, e, i) {
            var n;
            e && !el(e) && !Array.isArray(e) && h.indexOf(e.type) < 0 && (i = e,
            e = null),
            (n = o.call(this, t, i) || this)._maxZIndex = 0,
            n._minZIndex = 0,
            n._initCache(),
            e && n.addGeometry(e);
            var r = n.options.style;
            return r && n.setStyle(r),
            n
        }
        it(t, o);
        var e = t.prototype;
        return e.getGeometryById = function(t) {
            return ut(t) || "" === t ? null : this._geoMap[t] ? this._geoMap[t] : null
        }
        ,
        e.getGeometries = function(t, e) {
            if (!t)
                return this._geoList.slice(0);
            for (var i, n = [], r = 0, o = this._geoList.length; r < o; r++)
                i = this._geoList[r],
                (e ? t.call(e, i) : t(i)) && n.push(i);
            return n
        }
        ,
        e.getFirstGeometry = function() {
            return this._geoList.length ? this._geoList[0] : null
        }
        ,
        e.getLastGeometry = function() {
            var t = this._geoList.length;
            return 0 === t ? null : this._geoList[t - 1]
        }
        ,
        e.getCount = function() {
            return this._geoList.length
        }
        ,
        e.getExtent = function() {
            if (0 === this.getCount())
                return null;
            var e = new Zr(this.getProjection());
            return this.forEach(function(t) {
                e._combine(t.getExtent())
            }),
            e
        }
        ,
        e.forEach = function(t, e) {
            for (var i = this._geoList.slice(0), n = 0, r = i.length; n < r; n++)
                e ? t.call(e, i[n], n) : t(i[n], n);
            return this
        }
        ,
        e.filter = function(t, i) {
            var n = []
              , r = H(t)
              , o = r ? t : ue(t);
            return this.forEach(function(t) {
                var e = r ? t : xe(t);
                (i ? o.call(i, e) : o(e)) && n.push(t)
            }, this),
            n
        }
        ,
        e.isEmpty = function() {
            return !this._geoList.length
        }
        ,
        e.addGeometry = function(t, e) {
            if (!t)
                return this;
            if ("FeatureCollection" === t.type)
                return this.addGeometry(jh.toGeometry(t), e);
            if (!Array.isArray(t)) {
                var i = arguments.length
                  , n = arguments[i - 1];
                return t = Array.prototype.slice.call(arguments, 0, i - 1),
                (e = n) && _(n) && ("type"in n || el(n)) && (t.push(n),
                e = !1),
                this.addGeometry(t, e)
            }
            if (0 === t.length)
                return this;
            var r;
            this._initCache(),
            e && (r = new Zr),
            this._toSort = 0 < this._maxZIndex;
            for (var o = [], s = 0, a = t.length; s < a; s++) {
                var h = t[s];
                if (!h || !jh._isGeoJSON(h) && !el(h))
                    throw new Error("Invalid geometry to add to layer(" + this.getId() + ") at index:" + s);
                if (!h.getLayer || h.getLayer() !== this) {
                    if (!el(h) && (h = sa.fromJSON(h),
                    Array.isArray(h)))
                        for (var l = 0, u = h.length; l < u; l++)
                            this._add(h[l], r, s),
                            o.push(h[l]);
                    if (!h)
                        throw new Error("Invalid geometry to add to layer(" + this.getId() + ") at index:" + s);
                    Array.isArray(h) || (this._add(h, r, s),
                    o.push(h))
                }
            }
            var c = this.getMap();
            if (c && (this._getRenderer().onGeometryAdd(o),
            r && !ut(r.xmin))) {
                var d = r.getCenter()
                  , f = c.getFitZoom(r);
                if (_(e)) {
                    var g = H(e.step) ? e.step : function() {}
                    ;
                    c.animateTo({
                        center: d,
                        zoom: f
                    }, F({
                        duration: c.options.zoomAnimationDuration,
                        easing: "out"
                    }, e), g)
                } else
                    !0 === e && c.setCenterAndZoom(d, f)
            }
            return this.fire("addgeo", {
                geometries: t
            }),
            this
        }
        ,
        e.getGeoMinZIndex = function() {
            return this._minZIndex
        }
        ,
        e.getGeoMaxZIndex = function() {
            return this._maxZIndex
        }
        ,
        e._add = function(t, e, i) {
            this._toSort || (this._toSort = 0 !== t.getZIndex()),
            this._updateZIndex(t.getZIndex());
            var n = t.getId();
            if (!ut(n)) {
                if (!ut(this._geoMap[n]))
                    throw new Error("Duplicate geometry id in layer(" + this.getId() + "):" + n + ", at index:" + i);
                this._geoMap[n] = t
            }
            var r = mt();
            t._setInternalId(r),
            this._geoList.push(t),
            this.onAddGeometry(t),
            t._bindLayer(this),
            t.onAdd && t.onAdd(),
            e && e._combine(t.getExtent()),
            t._fireEvent("add", {
                layer: this
            }),
            this._cookedStyles && this._styleGeometry(t)
        }
        ,
        e.removeGeometry = function(t) {
            if (!Array.isArray(t))
                return this.removeGeometry([t]);
            for (var e = t.length - 1; 0 <= e; e--)
                t[e]instanceof sa || (t[e] = this.getGeometryById(t[e])),
                t[e] && this === t[e].getLayer() && t[e].remove();
            return this.fire("removegeo", {
                geometries: t
            }),
            this
        }
        ,
        e.clear = function() {
            this._clearing = !0,
            this.forEach(function(t) {
                t.remove()
            }),
            this._geoMap = {};
            var t = this._geoList;
            this._geoList = [];
            var e = this._getRenderer();
            return e && (e.onGeometryRemove(t),
            e.clearImageData && (e.clearImageData(),
            delete e._lastGeosToDraw)),
            this._clearing = !1,
            this.fire("clear"),
            this
        }
        ,
        e.onRemoveGeometry = function(t) {
            if (t && !this._clearing && (this === t.getLayer() && !ut(t._getInternalId()))) {
                var e = t.getId();
                ut(e) || delete this._geoMap[e];
                var i = this._findInList(t);
                0 <= i && this._geoList.splice(i, 1),
                this._getRenderer() && this._getRenderer().onGeometryRemove([t])
            }
        }
        ,
        e.getStyle = function() {
            return this.options.style ? this.options.style : null
        }
        ,
        e.setStyle = function(t) {
            return t = ii(this.options.style = t),
            this._cookedStyles = we(t),
            this.forEach(function(t) {
                this._styleGeometry(t)
            }, this),
            this.fire("setstyle", {
                style: t
            }),
            this
        }
        ,
        e._styleGeometry = function(t) {
            if (!this._cookedStyles)
                return !1;
            for (var e = xe(t), i = 0, n = this._cookedStyles.length; i < n; i++)
                if (!0 === this._cookedStyles[i].filter(e))
                    return t._setExternSymbol(this._cookedStyles[i].symbol),
                    !0;
            return !1
        }
        ,
        e.removeStyle = function() {
            return this.options.style && (delete this.options.style,
            delete this._cookedStyles,
            this.forEach(function(t) {
                t._setExternSymbol(null)
            }, this),
            this.fire("removestyle")),
            this
        }
        ,
        e.onAddGeometry = function(t) {
            this.getStyle() && this._styleGeometry(t)
        }
        ,
        e.hide = function() {
            for (var t = 0, e = this._geoList.length; t < e; t++)
                this._geoList[t].onHide();
            return ca.prototype.hide.call(this)
        }
        ,
        e._initCache = function() {
            this._geoList || (this._geoList = [],
            this._geoMap = {})
        }
        ,
        e._updateZIndex = function() {
            for (var t = arguments.length, e = new Array(t), i = 0; i < t; i++)
                e[i] = arguments[i];
            this._maxZIndex = Math.max(this._maxZIndex, Math.max.apply(Math, e)),
            this._minZIndex = Math.min(this._minZIndex, Math.min.apply(Math, e))
        }
        ,
        e._sortGeometries = function() {
            var i = this;
            this._toSort && (this._maxZIndex = 0,
            this._minZIndex = 0,
            this._geoList.sort(function(t, e) {
                return i._updateZIndex(t.getZIndex(), e.getZIndex()),
                i._compare(t, e)
            }),
            this._toSort = !1)
        }
        ,
        e._compare = function(t, e) {
            return t.getZIndex() === e.getZIndex() ? t._getInternalId() - e._getInternalId() : t.getZIndex() - e.getZIndex()
        }
        ,
        e._findInList = function(t) {
            var e = this._geoList.length;
            if (0 === e)
                return -1;
            this._sortGeometries();
            for (var i, n = 0, r = e - 1; n <= r; ) {
                if (i = Math.floor((n + r) / 2),
                this._geoList[i] === t)
                    return i;
                0 < this._compare(this._geoList[i], t) ? r = i - 1 : n = i + 1
            }
            return -1
        }
        ,
        e._onGeometryEvent = function(t) {
            if (t && t.target) {
                var e = t.type;
                "idchange" === e ? this._onGeometryIdChange(t) : "zindexchange" === e ? this._onGeometryZIndexChange(t) : "positionchange" === e ? this._onGeometryPositionChange(t) : "shapechange" === e ? this._onGeometryShapeChange(t) : "symbolchange" === e ? this._onGeometrySymbolChange(t) : "show" === e ? this._onGeometryShow(t) : "hide" === e ? this._onGeometryHide(t) : "propertieschange" === e && this._onGeometryPropertiesChange(t)
            }
        }
        ,
        e._onGeometryIdChange = function(t) {
            if (t.new !== t.old || !this._geoMap[t.old] || this._geoMap[t.old] !== t.target) {
                if (!ut(t.new)) {
                    if (this._geoMap[t.new])
                        throw new Error("Duplicate geometry id in layer(" + this.getId() + "):" + t.new);
                    this._geoMap[t.new] = t.target
                }
                ut(t.old) || t.new === t.old || delete this._geoMap[t.old]
            }
        }
        ,
        e._onGeometryZIndexChange = function(t) {
            t.old !== t.new && (this._updateZIndex(t.new),
            this._toSort = !0,
            this._getRenderer() && this._getRenderer().onGeometryZIndexChange(t))
        }
        ,
        e._onGeometryPositionChange = function(t) {
            this._getRenderer() && this._getRenderer().onGeometryPositionChange(t)
        }
        ,
        e._onGeometryShapeChange = function(t) {
            this._getRenderer() && this._getRenderer().onGeometryShapeChange(t)
        }
        ,
        e._onGeometrySymbolChange = function(t) {
            this._getRenderer() && this._getRenderer().onGeometrySymbolChange(t)
        }
        ,
        e._onGeometryShow = function(t) {
            this._getRenderer() && this._getRenderer().onGeometryShow(t)
        }
        ,
        e._onGeometryHide = function(t) {
            this._getRenderer() && this._getRenderer().onGeometryHide(t)
        }
        ,
        e._onGeometryPropertiesChange = function(t) {
            this._getRenderer() && this._getRenderer().onGeometryPropertiesChange(t)
        }
        ,
        e._hasGeoListeners = function(t) {
            if (!t)
                return !1;
            Array.isArray(t) || (il[0] = t,
            t = il);
            for (var e = this.getGeometries() || [], i = 0, n = e.length; i < n; i++) {
                var r = e[i];
                if (r) {
                    if (r.options.cursor)
                        return !0;
                    for (var o = 0, s = t.length; o < s; o++) {
                        var a = t[o];
                        if (0 < r.listens(a))
                            return !0
                    }
                }
            }
            return !1
        }
        ,
        t
    }(ca);
    nl.mergeOptions({
        drawImmediate: !1,
        geometryEvents: !0,
        geometryEventTolerance: 1
    });
    var rl = new Vr
      , ol = {
        debug: !1,
        enableSimplify: !0,
        defaultIconSize: [20, 20],
        cacheVectorOnCanvas: !0,
        cacheSvgOnCanvas: $.gecko,
        enableAltitude: !1,
        altitudeProperty: "altitude",
        drawAltitude: !1,
        sortByDistanceToCamera: !1,
        roundPoint: !1,
        altitude: 0,
        clipBBoxBufferSize: 3,
        collision: !1,
        collisionBufferSize: 2,
        collisionDelay: 250,
        collisionScope: "layer",
        progressiveRender: !1,
        progressiveRenderCount: 1e3,
        progressiveRenderDebug: !1
    }
      , sl = function(n) {
        function s(t, e, i) {
            return n.call(this, t, e, i) || this
        }
        it(s, n);
        var t = s.prototype;
        return t.onConfig = function(t) {
            if (n.prototype.onConfig.call(this, t),
            t.enableAltitude || t.drawAltitude || t.altitudeProperty) {
                var e = this.getRenderer();
                e && e.setToRedraw && e.setToRedraw()
            }
        }
        ,
        t.identify = function(t, e) {
            void 0 === e && (e = {});
            var i = this.getRenderer();
            t instanceof Rr || (t = new Rr(t));
            var n = this.getMap().coordToContainerPoint(t);
            return e.onlyVisible && i && i.identifyAtPoint ? i.identifyAtPoint(n, e) : this._hitGeos(this._geoList, n, e)
        }
        ,
        t.identifyAtPoint = function(t, e) {
            void 0 === e && (e = {});
            var i = this.getRenderer();
            return t instanceof dt || (t = new dt(t)),
            e.onlyVisible && i && i.identifyAtPoint ? i.identifyAtPoint(t, e) : this._hitGeos(this._geoList, t, e)
        }
        ,
        t._hitGeos = function(t, e, i) {
            if (void 0 === i && (i = {}),
            !t || !t.length)
                return [];
            var n = i.filter
              , r = []
              , o = i.tolerance
              , s = this.getMap()
              , a = this.getRenderer()
              , h = a && a.getImageData && a.getImageData();
            if (h) {
                var l = 0
                  , u = a.maxTolerance;
                if (G(u))
                    l = u;
                else
                    for (var c = t.length - 1; 0 <= c; c--) {
                        var d = t[c]._hitTestTolerance() + (o || 0);
                        l < d && (l = d)
                    }
                var f = s.getDevicePixelRatio();
                h.r = f;
                for (var g = !1, p = e.x - l, m = e.y - l, _ = -l; _ <= l; _++) {
                    for (var v = -l; v <= l; v++) {
                        var y = Math.round((p + _) * f)
                          , x = Math.round((m + v) * f) * h.width * 4 + 4 * y;
                        if (0 < h.data[x + 3]) {
                            g = !0;
                            break
                        }
                    }
                    if (g)
                        break
                }
                if (!g)
                    return r
            }
            for (var w = i.onlyVisible, C = t.length - 1; 0 <= C; C--) {
                var b = t[C];
                if (b && b.options.interactive && (w || b.isVisible())) {
                    var P = b._getPainter();
                    if (P) {
                        var M = P.getRenderBBOX && P.getRenderBBOX();
                        if (M) {
                            var T = e.x
                              , S = e.y;
                            if (T < M[0] || S < M[1] || T > M[2] || S > M[3])
                                continue
                        }
                        if (!(b instanceof Ph && (b._getArrowStyle() || b instanceof Nh))) {
                            var E = b.getContainerExtent(rl);
                            if (o && (E = E._expand(o)),
                            !E || !E.contains(e))
                                continue
                        }
                        if (b._containsPoint(e, o) && (!n || n(b)) && (r.push(b),
                        i.count && r.length >= i.count))
                            break
                    }
                }
            }
            return r
        }
        ,
        t.getAltitude = function() {
            return this.options.altitude || 0
        }
        ,
        t.toJSON = function(t) {
            t || (t = {});
            var e = {
                type: this.getJSONType(),
                id: this.getId(),
                options: this.config()
            };
            if (ut(t.geometries) || t.geometries) {
                var i;
                if (t.clipExtent) {
                    var n = this.getMap()
                      , r = n ? n.getProjection() : null;
                    i = new Zr(t.clipExtent,r)
                }
                for (var o = [], s = this.getGeometries(), a = 0, h = s.length; a < h; a++) {
                    var l = s[a]
                      , u = l.getExtent();
                    if (u && (!i || i.intersects(u))) {
                        var c = l.toJSON(t.geometries);
                        o.push(c)
                    }
                }
                e.geometries = o
            }
            return e
        }
        ,
        s.fromJSON = function(t) {
            if (!t || "VectorLayer" !== t.type)
                return null;
            for (var e = new s(t.id,t.options), i = t.geometries, n = [], r = 0; r < i.length; r++) {
                var o = sa.fromJSON(i[r]);
                o && n.push(o)
            }
            return e.addGeometry(n),
            e
        }
        ,
        s.getPainterClass = function() {
            return Ks
        }
        ,
        s.getCollectionPainterClass = function() {
            return ta
        }
        ,
        s
    }(nl);
    sl.mergeOptions(ol),
    sl.registerJSONType("VectorLayer");
    var al = "_map_tool"
      , hl = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addTo = function(t) {
            return t && ((this._map = t)[al] && t[al].disable(),
            this.onAdd && this.onAdd(),
            this.enable(),
            (t[al] = this)._fireEvent("add")),
            this
        }
        ,
        i.getMap = function() {
            return this._map
        }
        ,
        i.enable = function() {
            return !this._map || this._enabled || (this._enabled = !0,
            this._switchEvents("off"),
            this._registerEvents(),
            this.onEnable && this.onEnable(),
            this._fireEvent("enable")),
            this
        }
        ,
        i.disable = function() {
            return this._enabled && this._map && (this._enabled = !1,
            this._switchEvents("off"),
            this.onDisable && this.onDisable(),
            this._fireEvent("disable")),
            this
        }
        ,
        i.isEnabled = function() {
            return !!this._enabled
        }
        ,
        i.remove = function() {
            return this._map && (this.disable(),
            this._map && (delete this._map[al],
            delete this._map),
            this._fireEvent("remove")),
            this
        }
        ,
        i._registerEvents = function() {
            this._switchEvents("on")
        }
        ,
        i._switchEvents = function(t) {
            var e = this.getEvents();
            e && this._map[t](e, this)
        }
        ,
        i._fireEvent = function(t, e) {
            e || (e = {}),
            this.fire(t, e)
        }
        ,
        e
    }(Un(qn))
      , ll = {
        symbol: {
            lineColor: "#000",
            lineWidth: 2,
            lineOpacity: 1,
            polygonFill: "#fff",
            polygonOpacity: .3
        },
        doubleClickZoom: !1,
        mode: null,
        once: !1,
        autoPanAtEdge: !1,
        ignoreMouseleave: !0,
        blockGeometryEvents: !1,
        zIndex: Number.MAX_VALUE,
        enableAltitude: !0
    }
      , ul = {}
      , cl = function(i) {
        function n(t) {
            var e;
            return (e = i.call(this, t) || this)._checkMode(),
            e._events = {
                click: e._clickHandler,
                "mousemove touchmove": e._mouseMoveHandler,
                dblclick: e._doubleClickHandler,
                "mousedown touchstart": e._mouseDownHandler,
                "mouseup touchend": e._mouseUpHandler,
                mousemove: e._mouseMoveHandler,
                mousedown: e._mouseDownHandler,
                mouseup: e._mouseUpHandler
            },
            e
        }
        it(n, i),
        n.registerMode = function(t, e) {
            ul[t.toLowerCase()] = e
        }
        ,
        n.getRegisterMode = function(t) {
            return ul[t.toLowerCase()]
        }
        ;
        var t = n.prototype;
        return t.getMode = function() {
            return this.options.mode ? this.options.mode.toLowerCase() : null
        }
        ,
        t.setMode = function(t) {
            return this._geometry && (this._geometry.remove(),
            delete this._geometry),
            this._clearStage(),
            this._switchEvents("off"),
            this.options.mode = t,
            this._checkMode(),
            this.isEnabled() && (this._switchEvents("on"),
            this._restoreMapCfg(),
            this._saveMapCfg()),
            this
        }
        ,
        t.getSymbol = function() {
            var t = this.options.symbol;
            return ei(t || this.options.symbol)
        }
        ,
        t.setSymbol = function(t) {
            return t && (this.options.symbol = t,
            this._geometry && this._geometry.setSymbol(t)),
            this
        }
        ,
        t.getCurrentGeometry = function() {
            return this._geometry
        }
        ,
        t.onAdd = function() {
            this._checkMode()
        }
        ,
        t.onEnable = function() {
            this._saveMapCfg(),
            this._drawToolLayer = this._getDrawLayer(),
            this._clearStage(),
            this._loadResources();
            var t = this.getMap();
            return this.options.autoPanAtEdge && (this._mapAutoPanAtEdge = t.options.autoPanAtEdge,
            this._mapAutoPanAtEdge || t.config({
                autoPanAtEdge: !0
            })),
            this._geometryEvents = t.options.geometryEvents,
            this.options.blockGeometryEvents && t.config("geometryEvents", !1),
            this
        }
        ,
        t.onDisable = function() {
            var t = this.getMap();
            return this._restoreMapCfg(),
            this.endDraw({
                ignoreEndEvent: !0
            }),
            this._map && (t.removeLayer(this._getDrawLayer()),
            this.options.autoPanAtEdge && (this._mapAutoPanAtEdge || t.config({
                autoPanAtEdge: !1
            }))),
            this.options.blockGeometryEvents && t.config("geometryEvents", this._geometryEvents),
            this
        }
        ,
        t.undo = function() {
            var t = this._getRegisterMode()
              , e = t.action;
            if (!this._shouldRecordHistory(e) || !this._historyPointer)
                return this;
            var i = this._clickCoords.slice(0, --this._historyPointer);
            return t.update(this.getMap().getProjection(), i, this._geometry),
            this
        }
        ,
        t.redo = function() {
            var t = this._getRegisterMode()
              , e = t.action;
            if (!this._shouldRecordHistory(e) || ut(this._historyPointer) || this._historyPointer === this._clickCoords.length)
                return this;
            var i = this._clickCoords.slice(0, ++this._historyPointer);
            return t.update(this.getMap().getProjection(), i, this._geometry),
            this
        }
        ,
        t._shouldRecordHistory = function(t) {
            return Array.isArray(t) && "click" === t[0] && "mousemove" === t[1] && "dblclick" === t[2]
        }
        ,
        t._checkMode = function() {
            this._getRegisterMode()
        }
        ,
        t._saveMapCfg = function() {
            var t = this.getMap();
            this._mapDoubleClickZoom = t.options.doubleClickZoom,
            t.config({
                doubleClickZoom: this.options.doubleClickZoom
            });
            for (var e = this._getRegisterMode().action, i = !1, n = 0; n < e.length; n++)
                if (0 <= e[n].indexOf("mousedown") || 0 <= e[n].indexOf("touchstart")) {
                    i = !0;
                    break
                }
            if (i) {
                var r = this.getMap();
                this._mapDraggable = r.options.draggable,
                r.config({
                    draggable: !1
                })
            }
        }
        ,
        t._restoreMapCfg = function() {
            var t = this.getMap();
            t.config({
                doubleClickZoom: this._mapDoubleClickZoom
            }),
            ut(this._mapDraggable) || t.config("draggable", this._mapDraggable),
            delete this._mapDraggable,
            delete this._mapDoubleClickZoom
        }
        ,
        t._loadResources = function() {
            var t = Re(this.getSymbol());
            0 < t.length && this._drawToolLayer._getRenderer().loadResources(t)
        }
        ,
        t._getProjection = function() {
            return this._map.getProjection()
        }
        ,
        t._getRegisterMode = function() {
            var t = this.getMode()
              , e = n.getRegisterMode(t);
            if (!e)
                throw new Error(t + " is not a valid mode of DrawTool.");
            return e
        }
        ,
        t.getEvents = function() {
            var t = this._getRegisterMode().action
              , e = {};
            if (Array.isArray(t)) {
                for (var i = 0; i < t.length; i++)
                    e[t[i]] = this._events[t[i]];
                return e
            }
            return null
        }
        ,
        t._mouseDownHandler = function(t) {
            this._createGeometry(t)
        }
        ,
        t._mouseUpHandler = function(t) {
            this.endDraw(t)
        }
        ,
        t._clickHandler = function(t) {
            t.enableAltitude = this.options.enableAltitude;
            var e = this.getMap()
              , i = this._getRegisterMode();
            if (this._clickCoords && this._clickCoords.length) {
                var n = this._clickCoords.length
                  , r = e._pointToPrj(t.point2d);
                if (this._clickCoords[n - 1].equals(r))
                    return
            }
            if (this._geometry) {
                var o = e._pointToPrj(t.point2d);
                ut(this._historyPointer) || (this._clickCoords = this._clickCoords.slice(0, this._historyPointer));
                var s = this._geometry.snapTo;
                if (s && H(s)) {
                    var a = this._getSnapResult(s, t.containerPoint);
                    if (o = a.prjCoord,
                    this._clickCoords = this._clickCoords.concat(a.effectedVertex),
                    this._clickCoords[this._clickCoords.length - 1].equals(o))
                        return
                }
                if (this._clickCoords.push(o),
                this._historyPointer = this._clickCoords.length,
                t.drawTool = this,
                i.update(e.getProjection(), this._clickCoords, this._geometry, t),
                "point" === this.getMode())
                    return void this.endDraw(t);
                this._clickCoords.length <= 1 ? this._fireEvent("drawstart", t) : this._fireEvent("drawvertex", t),
                i.clickLimit && i.clickLimit === this._historyPointer && this.endDraw(t)
            } else
                this._createGeometry(t)
        }
        ,
        t._createGeometry = function(t) {
            var e = this.getMode()
              , i = this._getRegisterMode()
              , n = this.getMap()._pointToPrj(t.point2d)
              , r = this.getSymbol();
            if (!this._geometry) {
                this._fireEvent("drawprepare", t),
                this._clickCoords = [n],
                (t.drawTool = this)._geometry = i.create(this.getMap().getProjection(), this._clickCoords, t),
                r && "point" !== e ? this._geometry.setSymbol(r) : this.options.hasOwnProperty("symbol") && this._geometry.setSymbol(this.options.symbol),
                this._addGeometryToStage(this._geometry),
                this._fireEvent("drawstart", t);
                var o = this._geometry.snapTo;
                if (o && H(o)) {
                    var s = this._getSnapResult(o, t.containerPoint)
                      , a = this.getMap();
                    if (a && s) {
                        var h = s.prjCoord;
                        this._clickCoords = [h],
                        i.update(a.getProjection(), this._clickCoords, this._geometry, t)
                    }
                }
            }
            "point" === e && "mousemove" !== t.type && this.endDraw(t)
        }
        ,
        t._mouseMoveHandler = function(t) {
            t.enableAltitude = this.options.enableAltitude;
            var e = this.getMap();
            if (e && !e.isInteracting())
                if ("point" !== this.getMode() || this._geometry) {
                    if (this._geometry) {
                        var i = this._getMouseContainerPoint(t);
                        if (this._isValidContainerPoint(i)) {
                            var n = e._pointToPrj(t.point2d)
                              , r = []
                              , o = this._geometry.snapTo;
                            if (o && H(o)) {
                                var s = this._getSnapResult(o, i);
                                n = s.prjCoord,
                                r = s.effectedVertex
                            }
                            var a = e.getProjection()
                              , h = (t.drawTool = this)._getRegisterMode();
                            if (this._shouldRecordHistory(h.action)) {
                                var l = this._clickCoords.slice(0, this._historyPointer);
                                if (l && 0 < l.length && n.equals(l[l.length - 1]))
                                    return;
                                h.update(a, l.concat(r, [n]), this._geometry, t)
                            } else
                                h.update(a, n, this._geometry, t);
                            this._fireEvent("mousemove", t)
                        }
                    }
                } else
                    this._createGeometry(t)
        }
        ,
        t._doubleClickHandler = function(t) {
            if (t.enableAltitude = this.options.enableAltitude,
            this._geometry) {
                var e = this._getMouseContainerPoint(t);
                if (this._isValidContainerPoint(e)) {
                    var i = this._getRegisterMode()
                      , n = this._clickCoords;
                    if (n && !(n.length < 2)) {
                        var r = this.getMode();
                        if (!(r && -1 < r.indexOf("polygon") && n.length < 3)) {
                            for (var o = this.getMap().getProjection(), s = [n[0]], a = 1, h = n.length; a < h; a++)
                                n[a].x === n[a - 1].x && n[a].y === n[a - 1].y || s.push(n[a]);
                            s.length < 2 || this._geometry && this._geometry instanceof yh && s.length < 3 || (t.drawTool = this,
                            i.update(o, s, this._geometry, t),
                            this.endDraw(t))
                        }
                    }
                }
            }
        }
        ,
        t._addGeometryToStage = function(t) {
            this._getDrawLayer().addGeometry(t)
        }
        ,
        t.endDraw = function(t) {
            if (!this._geometry || this._ending)
                return this;
            this._ending = !0;
            var e = this._geometry;
            return this._clearStage(),
            t = t || {},
            this._geometry = e,
            t.ignoreEndEvent || this._fireEvent("drawend", t),
            delete this._geometry,
            this.options.once && this.disable(),
            delete this._ending,
            delete this._historyPointer,
            this._vertexes && (this._vertexes = []),
            this
        }
        ,
        t._clearStage = function() {
            this._getDrawLayer().clear(),
            delete this._geometry,
            delete this._clickCoords
        }
        ,
        t._getMouseContainerPoint = function(t) {
            var e = this._getRegisterMode().action;
            return (0 <= e[0].indexOf("mousedown") || 0 <= e[0].indexOf("touchstart")) && wi(t.domEvent),
            t.containerPoint
        }
        ,
        t._isValidContainerPoint = function(t) {
            var e = this._map.getSize()
              , i = e.width
              , n = e.height;
            return !(t.x < 0 || t.y < 0) && !(t.x > i || t.y > n)
        }
        ,
        t._getSnapResult = function(t, e) {
            var i = this.getMap()
              , n = [];
            if (this.options.edgeAutoComplete) {
                var r = this._clickCoords[(this._historyPointer || 1) - 1];
                n.push(i._prjToContainerPoint(r));
                var o = this._clickCoords[(this._historyPointer || 1) - 2];
                o && n.push(i._prjToContainerPoint(o))
            }
            var s = t(e, n);
            e = (s.effectedVertex ? s.point : s) || e;
            var a = i._containerPointToPrj(e);
            return s.effectedVertex && (s.effectedVertex = s.effectedVertex.map(function(t) {
                return i._containerPointToPrj(t)
            })),
            {
                prjCoord: a,
                effectedVertex: s.effectedVertex || []
            }
        }
        ,
        t._getDrawLayer = function() {
            var t = g + "drawtool"
              , e = this._map.getLayer(t);
            return e || (e = new sl(t,{
                enableSimplify: !1,
                enableAltitude: this.options.enableAltitude,
                zIndex: this.options.zIndex
            }),
            this._map.addLayer(e)),
            this._pushLayers(e),
            e
        }
        ,
        t._fireEvent = function(t, e) {
            e || (e = {}),
            e = F({}, e),
            this._geometry && (e.geometry = this._getRegisterMode().generate(this._geometry, {
                drawTool: this
            }),
            e.tempGeometry = this._geometry),
            hl.prototype._fireEvent.call(this, t, e)
        }
        ,
        t._pushLayers = function(t) {
            var e = this;
            return t && (Array.isArray(t) || (t = [t]),
            this._layers = this._layers || [],
            t.forEach(function(t) {
                -1 === e._layers.indexOf(t) && e._layers.push(t)
            })),
            this
        }
        ,
        t._outLayers = function(t) {
            var n = this;
            return t && (Array.isArray(t) || (t = [t]),
            this._layers = this._layers || [],
            t.forEach(function(t) {
                for (var e = 0, i = n._layers.length; e < i; e++)
                    if (t === n._layers[e]) {
                        n._layers.splice(e, 1);
                        break
                    }
            })),
            this
        }
        ,
        t.setLayerZIndex = function(e) {
            return G(e) && (this.options.zIndex = e,
            this._layers = this._layers || [],
            this._layers.forEach(function(t) {
                t && t.setZIndex && t.setZIndex(e)
            })),
            this
        }
        ,
        n
    }(hl);
    cl.mergeOptions(ll);
    var dl = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this).drawTool = new cl({
                mode: "boxZoom",
                ignoreMouseleave: !1
            }),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.addHooks = function() {
            this.target.on("_mousedown", this._onMouseDown, this)
        }
        ,
        e.removeHooks = function() {
            this.target.off("_mousedown", this._onMouseDown, this),
            this.drawTool.isEnabled() && this.drawTool.remove()
        }
        ,
        e._onMouseDown = function(t) {
            this.target.options.boxZoom && t.domEvent.shiftKey && this.drawTool.setSymbol(this.target.options.boxZoomSymbol).on("drawend", this._boxZoom, this).addTo(this.target)
        }
        ,
        e._boxZoom = function(t) {
            var e = this.target;
            this.drawTool.remove();
            var i = t.geometry
              , n = i.getCenter()
              , r = i.getSymbol()
              , o = r.markerWidth
              , s = r.markerHeight
              , a = new Zr(n,e.locateByPoint(n, o, s),e.getProjection())
              , h = e.getFitZoom(a);
            e._animateTo({
                center: a.getCenter(),
                zoom: h
            })
        }
        ,
        t
    }(Jn);
    Qa.mergeOptions({
        boxZoom: !0,
        boxZoomSymbol: {
            markerType: "rectangle",
            markerLineWidth: 3,
            markerLineColor: "#1bbc9b",
            markerLineDasharray: [10, 5],
            markerFillOpacity: .1,
            markerFill: "#1bbc9b",
            markerWidth: 1,
            markerHeight: 1
        }
    }),
    Qa.addOnLoadHook("addHandler", "boxZoom", dl);
    var fl = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.addHooks = function() {
            this.target && this.target.on("_mousemove", this._onMouseMove, this)
        }
        ,
        i.removeHooks = function() {
            this.target && this.target.off("_mousemove", this._onMouseMove, this)
        }
        ,
        i._onMouseMove = function(t) {
            var e = this.target;
            if (e.options.autoPanAtEdge) {
                var i = t.containerPoint
                  , n = e.getContainerExtent();
                if (n) {
                    var r, o = i.x, s = i.y, a = n.xmax, h = n.ymax;
                    o < 30 && (r = [Math.abs(o - 30), 0]),
                    s < 30 && (r = [0, Math.abs(s - 30)]),
                    a < o + 30 && (r = [-Math.abs(o + 30 - a), 0]),
                    h < s + 30 && (r = [0, -Math.abs(s + 30 - h)]),
                    r && e.panBy(r, {
                        duration: 1
                    })
                }
            }
        }
        ,
        e
    }(Jn);
    function gl(t, e, i) {
        return t * (1 - i) + e * i
    }
    function pl(t) {
        t.stopPropagation(),
        t.preventDefault()
    }
    Qa.mergeOptions({
        autoPanAtEdge: !1
    }),
    Qa.addOnLoadHook("addHandler", "autoPanAtEdge", fl),
    Qa.include({
        animateTo: function(t, n, r) {
            var o = this;
            void 0 === n && (n = {}),
            t = F({}, this.getView(), t),
            H(n) && (r = n,
            n = {});
            var s = this.getProjection()
              , e = this.getView()
              , a = {}
              , i = !0;
            for (var h in t)
                if (v(t, h) && !ut(t[h]) && ("prjCenter" === h || !ut(e[h])))
                    if (i = !1,
                    "center" === h) {
                        var l = new Rr(e[h])
                          , u = new Rr(t[h]);
                        l.equals(u) || (a.center = [l, u])
                    } else if ("prjCenter" === h) {
                        var c = new Rr(this._getPrjCenter())
                          , d = new Rr(t[h]);
                        c.equals(d) || (a.prjCenter = [c, d])
                    } else
                        e[h] !== t[h] && "around" !== h && (a[h] = [e[h], t[h]]);
            if (i)
                return null;
            this._animPlayer && (this._isInternalAnimation ? "running" === this._animPlayer.playState && (this._animPlayer.pause(),
            this._prevAnimPlayer = this._animPlayer) : (delete this._prevAnimPlayer,
            this._stopAnim(this._animPlayer)));
            var f = t.around || new dt(this.width / 2,this.height / 2)
              , g = this._getRenderer()
              , p = this._animPlayer = fh.animate(a, {
                easing: n.easing || "out",
                duration: n.duration || this.options.zoomAnimationDuration,
                framer: function(t) {
                    g.callInNextFrame(t)
                },
                repeat: n.repeat
            }, function(t) {
                if (o.isRemoved())
                    p.finish();
                else {
                    if ("running" === p.playState) {
                        if (t.styles.center) {
                            var e = t.styles.center;
                            o._setPrjCenter(s.project(e)),
                            o.onMoving(o._parseEventFromCoord(o.getCenter()))
                        } else if (t.styles.prjCenter) {
                            var i = t.styles.prjCenter;
                            o._setPrjCenter(i),
                            o.onMoving(o._parseEventFromCoord(o.getCenter()))
                        }
                        ut(t.styles.zoom) || o.onZooming(t.styles.zoom, f),
                        ut(t.styles.pitch) || o._setPitch(t.styles.pitch),
                        ut(t.styles.bearing) || o._setBearing(t.styles.bearing),
                        o._fireEvent("animating")
                    } else
                        "paused" === p.playState && p !== o._mapAnimPlayer || (p._interupted || (a.center ? o._setPrjCenter(s.project(a.center[1])) : a.prjCenter && o._setPrjCenter(a.prjCenter[1]),
                        ut(a.pitch) || o._setPitch(a.pitch[1]),
                        ut(a.bearing) || o._setBearing(a.bearing[1])),
                        o._endAnim(p, a, f, n));
                    r && r(t)
                }
            }, this);
            return this._startAnim(a, f),
            p
        },
        _animateTo: function(t, e, i) {
            return void 0 === e && (e = {}),
            this._mapAnimPlayer && this._stopAnim(this._mapAnimPlayer),
            this._isInternalAnimation = !0,
            this._mapAnimPlayer = this.animateTo(t, e, i),
            delete this._isInternalAnimation,
            this._mapAnimPlayer
        },
        flyTo: function(u, c, d) {
            var f = this;
            void 0 === c && (c = {}),
            u = F({}, this.getView(), u),
            this._animPlayer && (this._isInternalAnimation ? "running" === this._animPlayer.playState && (this._animPlayer.pause(),
            this._prevAnimPlayer = this._animPlayer) : (delete this._prevAnimPlayer,
            this._stopAnim(this._animPlayer))),
            H(c) && (d = c,
            c = {}),
            c = F({
                curve: 1.42
            }, c);
            var i = this;
            function t(t, e) {
                return i.getResolution(e) / i.getResolution(t)
            }
            var g = u.around || new dt(this.width / 2,this.height / 2)
              , e = this.getMinZoom()
              , n = this.getMaxZoom()
              , r = this.getProjection()
              , o = this.getView()
              , p = o.zoom
              , m = o.bearing
              , _ = o.pitch
              , v = "zoom"in u ? Tt(+u.zoom, e, n) : p
              , y = "bearing"in u ? +u.bearing : m
              , x = "pitch"in u ? +u.pitch : _
              , w = r.project(u.center && new Rr(u.center) || this.getCenter())
              , s = t(v, p)
              , C = r.project(this.getCenter())
              , b = w.sub(C)
              , a = c.curve
              , h = Math.max(this.width, this.height)
              , l = h / s
              , P = b.mag();
            if ("minZoom"in c) {
                var M = Tt(Math.min(c.minZoom, p, v), e, n)
                  , T = h / t(M, p);
                a = Math.sqrt(T / P * 2)
            }
            var S = a * a;
            function E(t) {
                var e = (l * l - h * h + (t ? -1 : 1) * S * S * P * P) / (2 * (t ? l : h) * S * P);
                return Math.log(Math.sqrt(e * e + 1) - e)
            }
            function R(t) {
                return (Math.exp(t) - Math.exp(-t)) / 2
            }
            function A(t) {
                return (Math.exp(t) + Math.exp(-t)) / 2
            }
            var k = E(0)
              , O = function(t) {
                return A(k) / A(k + a * t)
            }
              , L = function(t) {
                return h * ((A(k) * (R(e = k + a * t) / A(e)) - R(k)) / S) / P;
                var e
            }
              , D = (E(1) - k) / a;
            if (Math.abs(P) < 1e-6 || !isFinite(D)) {
                if (Math.abs(h - l) < 1e-6)
                    return this.animateTo(u, c, d);
                var I = l < h ? -1 : 1;
                D = Math.abs(Math.log(l / h)) / a,
                L = function() {
                    return 0
                }
                ,
                O = function(t) {
                    return Math.exp(I * a * t)
                }
            }
            var z = this._getRenderer()
              , j = this._animPlayer = fh.animate({
                k: [0, 1]
            }, {
                easing: c.easing || "out",
                duration: c.duration || 8,
                framer: function(t) {
                    z.callInNextFrame(t)
                }
            }, function(t) {
                if (f.isRemoved())
                    j.finish();
                else {
                    var e = t.styles.k
                      , i = e * D
                      , n = 1 / O(i)
                      , r = {};
                    if (u.center) {
                        var o = 1 === e ? w : C.add(b.multi(L(i)));
                        r.prjCenter = [w, o]
                    }
                    if (p !== v) {
                        var s = 1 === e ? v : f.getZoomForScale(n, p, !0);
                        r.zoom = [p, s]
                    }
                    if (_ !== x) {
                        var a = gl(_, x, e);
                        r.pitch = [x, a]
                    }
                    if (m !== y) {
                        var h = gl(m, y, e);
                        r.bearing = [y, h]
                    }
                    if ("running" === j.playState) {
                        if (r.prjCenter) {
                            var l = r.prjCenter;
                            f._setPrjCenter(l[1]),
                            f.onMoving(f._parseEventFromCoord(f.getCenter()))
                        }
                        r.zoom && f.onZooming(r.zoom[1], g),
                        r.pitch && f._setPitch(r.pitch[1]),
                        r.bearing && f._setBearing(r.bearing[1]),
                        f._fireEvent("animating")
                    } else
                        "paused" === j.playState && j !== f._mapAnimPlayer || (j._interupted || (r.prjCenter && f._setPrjCenter(r.prjCenter[1]),
                        r.pitch && f._setPitch(r.pitch[1]),
                        r.bearing && f._setBearing(r.bearing[1])),
                        f._endAnim(j, r, g, c));
                    d && d(t)
                }
            });
            return this._startAnim({
                center: u.center,
                zoom: u.zoom !== p,
                pitch: x !== _,
                bearing: y !== m
            }, g),
            this
        },
        isAnimating: function() {
            return !!this._animPlayer
        },
        isRotating: function() {
            return this.isDragRotating() || !!this._animRotating
        },
        _endAnim: function(t, e, i, n) {
            delete this._animRotating;
            var r, o = t._interupted ? "animateinterrupted" : "animateend";
            if (t === this._animPlayer && delete this._animPlayer,
            t === this._mapAnimPlayer && delete this._mapAnimPlayer,
            e.center)
                r = t._interupted ? this.getCenter() : e.center[1],
                this.onMoveEnd(this._parseEventFromCoord(r));
            else if (e.prjCenter) {
                var s;
                s = t._interupted ? this._getPrjCenter() : e.prjCenter[1];
                var a = this._parseEventFromCoord(this.getProjection().unproject(s));
                a.point2d = this._prjToPoint(s),
                this.onMoveEnd(a)
            }
            ut(e.zoom) || (t._interupted ? this.onZoomEnd(this.getZoom()) : n.wheelZoom ? this.onZooming(e.zoom[1], i) : this.onZoomEnd(e.zoom[1])),
            o && this._fireEvent(o),
            ut(e.pitch) || this.getPitch() || this.getRenderer().setToRedraw(),
            n.wheelZoom || this._resumePrev(t)
        },
        _startAnim: function(t, e) {
            this._animPlayer && ((t.center || t.prjCenter) && this.onMoveStart(),
            t.zoom && !this.isZooming() && this.onZoomStart(t.zoom[1], e),
            (t.pitch || t.bearing) && (this._animRotating = !0),
            this._fireEvent("animatestart"),
            this._animPlayer.play())
        },
        _stopAnim: function(t) {
            t && (delete this._animRotating,
            "finished" !== t.playState && (t._interupted = !0,
            t.cancel()),
            t === this._animPlayer && delete this._animPlayer,
            t === this._mapAnimPlayer && delete this._mapAnimPlayer)
        },
        _resumePrev: function(t) {
            if (this._prevAnimPlayer) {
                var e = this._prevAnimPlayer;
                "paused" !== e.playState && delete this._prevAnimPlayer,
                t !== e && (this._animPlayer = e).play()
            }
        }
    });
    var ml = ["dragstart", "dragenter", "dragend", "dragleave", "dragover"].join(" ").toString()
      , _l = "mousedown mouseup mouseover mouseout mouseenter mouseleave mousemove click dblclick contextmenu keypress touchstart touchmove touchend drop ";
    function vl(t, e, i, n, r) {
        var o = 1 / Math.tan(e / 2)
          , s = 1 / (n - r);
        return t[0] = o / i,
        t[1] = 0,
        t[2] = 0,
        t[3] = 0,
        t[4] = 0,
        t[5] = o,
        t[6] = 0,
        t[7] = 0,
        t[8] = 0,
        t[9] = 0,
        t[10] = (r + n) * s,
        t[11] = -1,
        t[12] = 0,
        t[13] = 0,
        t[14] = 2 * r * n * s,
        t[15] = 0,
        t
    }
    function yl(t, e, i) {
        var n, r, o, s, a, h, l, u, c, d, f, g, p = i[0], m = i[1], _ = i[2];
        return e === t ? (t[12] = e[0] * p + e[4] * m + e[8] * _ + e[12],
        t[13] = e[1] * p + e[5] * m + e[9] * _ + e[13],
        t[14] = e[2] * p + e[6] * m + e[10] * _ + e[14],
        t[15] = e[3] * p + e[7] * m + e[11] * _ + e[15]) : (n = e[0],
        r = e[1],
        o = e[2],
        s = e[3],
        a = e[4],
        h = e[5],
        l = e[6],
        u = e[7],
        c = e[8],
        d = e[9],
        f = e[10],
        g = e[11],
        t[0] = n,
        t[1] = r,
        t[2] = o,
        t[3] = s,
        t[4] = a,
        t[5] = h,
        t[6] = l,
        t[7] = u,
        t[8] = c,
        t[9] = d,
        t[10] = f,
        t[11] = g,
        t[12] = n * p + a * m + c * _ + e[12],
        t[13] = r * p + h * m + d * _ + e[13],
        t[14] = o * p + l * m + f * _ + e[14],
        t[15] = s * p + u * m + g * _ + e[15]),
        t
    }
    function xl(t, e, i) {
        var n = i[0]
          , r = i[1]
          , o = i[2];
        return t[0] = e[0] * n,
        t[1] = e[1] * n,
        t[2] = e[2] * n,
        t[3] = e[3] * n,
        t[4] = e[4] * r,
        t[5] = e[5] * r,
        t[6] = e[6] * r,
        t[7] = e[7] * r,
        t[8] = e[8] * o,
        t[9] = e[9] * o,
        t[10] = e[10] * o,
        t[11] = e[11] * o,
        t[12] = e[12],
        t[13] = e[13],
        t[14] = e[14],
        t[15] = e[15],
        t
    }
    function wl(t, e, i) {
        var n = e[0]
          , r = e[1]
          , o = e[2]
          , s = e[3]
          , a = e[4]
          , h = e[5]
          , l = e[6]
          , u = e[7]
          , c = e[8]
          , d = e[9]
          , f = e[10]
          , g = e[11]
          , p = e[12]
          , m = e[13]
          , _ = e[14]
          , v = e[15]
          , y = i[0]
          , x = i[1]
          , w = i[2]
          , C = i[3];
        return t[0] = y * n + x * a + w * c + C * p,
        t[1] = y * r + x * h + w * d + C * m,
        t[2] = y * o + x * l + w * f + C * _,
        t[3] = y * s + x * u + w * g + C * v,
        y = i[4],
        x = i[5],
        w = i[6],
        C = i[7],
        t[4] = y * n + x * a + w * c + C * p,
        t[5] = y * r + x * h + w * d + C * m,
        t[6] = y * o + x * l + w * f + C * _,
        t[7] = y * s + x * u + w * g + C * v,
        y = i[8],
        x = i[9],
        w = i[10],
        C = i[11],
        t[8] = y * n + x * a + w * c + C * p,
        t[9] = y * r + x * h + w * d + C * m,
        t[10] = y * o + x * l + w * f + C * _,
        t[11] = y * s + x * u + w * g + C * v,
        y = i[12],
        x = i[13],
        w = i[14],
        C = i[15],
        t[12] = y * n + x * a + w * c + C * p,
        t[13] = y * r + x * h + w * d + C * m,
        t[14] = y * o + x * l + w * f + C * _,
        t[15] = y * s + x * u + w * g + C * v,
        t
    }
    function Cl(t, e) {
        var i = e[0]
          , n = e[1]
          , r = e[2]
          , o = e[3]
          , s = e[4]
          , a = e[5]
          , h = e[6]
          , l = e[7]
          , u = e[8]
          , c = e[9]
          , d = e[10]
          , f = e[11]
          , g = e[12]
          , p = e[13]
          , m = e[14]
          , _ = e[15]
          , v = i * a - n * s
          , y = i * h - r * s
          , x = i * l - o * s
          , w = n * h - r * a
          , C = n * l - o * a
          , b = r * l - o * h
          , P = u * p - c * g
          , M = u * m - d * g
          , T = u * _ - f * g
          , S = c * m - d * p
          , E = c * _ - f * p
          , R = d * _ - f * m
          , A = v * R - y * E + x * S + w * T - C * M + b * P;
        return A ? (A = 1 / A,
        t[0] = (a * R - h * E + l * S) * A,
        t[1] = (r * E - n * R - o * S) * A,
        t[2] = (p * b - m * C + _ * w) * A,
        t[3] = (d * C - c * b - f * w) * A,
        t[4] = (h * T - s * R - l * M) * A,
        t[5] = (i * R - r * T + o * M) * A,
        t[6] = (m * x - g * b - _ * y) * A,
        t[7] = (u * b - d * x + f * y) * A,
        t[8] = (s * E - a * T + l * P) * A,
        t[9] = (n * T - i * E - o * P) * A,
        t[10] = (g * C - p * x + _ * v) * A,
        t[11] = (c * x - u * C - f * v) * A,
        t[12] = (a * M - s * S - h * P) * A,
        t[13] = (i * S - n * M + r * P) * A,
        t[14] = (p * y - g * w - m * v) * A,
        t[15] = (u * w - c * y + d * v) * A,
        t) : null
    }
    function bl(t) {
        return t[0] = 1,
        t[1] = 0,
        t[2] = 0,
        t[3] = 0,
        t[4] = 0,
        t[5] = 1,
        t[6] = 0,
        t[7] = 0,
        t[8] = 0,
        t[9] = 0,
        t[10] = 1,
        t[11] = 0,
        t[12] = 0,
        t[13] = 0,
        t[14] = 0,
        t[15] = 1,
        t
    }
    function Pl(t, e) {
        return t[0] = e[0],
        t[1] = e[1],
        t[2] = e[2],
        t[3] = e[3],
        t[4] = e[4],
        t[5] = e[5],
        t[6] = e[6],
        t[7] = e[7],
        t[8] = e[8],
        t[9] = e[9],
        t[10] = e[10],
        t[11] = e[11],
        t[12] = e[12],
        t[13] = e[13],
        t[14] = e[14],
        t[15] = e[15],
        t
    }
    function Ml(t, e, i, n) {
        return t[0] = e,
        t[1] = i,
        t[2] = n,
        t
    }
    function Tl(t, e, i) {
        return t[0] = e[0] - i[0],
        t[1] = e[1] - i[1],
        t[2] = e[2] - i[2],
        t
    }
    function Sl(t) {
        var e = t[0]
          , i = t[1]
          , n = t[2];
        return Math.sqrt(e * e + i * i + n * n)
    }
    function El(t, e) {
        var i = e[0]
          , n = e[1]
          , r = e[2]
          , o = i * i + n * n + r * r;
        return 0 < o && (o = 1 / Math.sqrt(o),
        t[0] = e[0] * o,
        t[1] = e[1] * o,
        t[2] = e[2] * o),
        t
    }
    function Rl(t, e) {
        return t[0] * e[0] + t[1] * e[1] + t[2] * e[2]
    }
    function Al(t, e, i) {
        var n = e[0]
          , r = e[1]
          , o = e[2]
          , s = i[0]
          , a = i[1]
          , h = i[2];
        return t[0] = r * h - o * a,
        t[1] = o * s - n * h,
        t[2] = n * a - r * s,
        t
    }
    function kl(t, e) {
        var i = e[0] - t[0]
          , n = e[1] - t[1]
          , r = e[2] - t[2];
        return Math.hypot ? Math.hypot(i, n, r) : function() {
            var t = 0
              , e = arguments.length;
            for (; e--; )
                t += arguments[e] * arguments[e];
            return Math.sqrt(t)
        }(i, n, r)
    }
    function Ol(t, e) {
        El(t, t),
        El(e, e);
        var i = Rl(t, e);
        return 1 < i ? 0 : i < -1 ? Math.PI : Math.acos(i)
    }
    function Ll(t, e, i) {
        var n = e[0]
          , r = e[1]
          , o = e[2]
          , s = 1 / (i[3] * n + i[7] * r + i[11] * o + i[15]);
        return t[0] = (i[0] * n + i[4] * r + i[8] * o + i[12]) * s,
        t[1] = (i[1] * n + i[5] * r + i[9] * o + i[13]) * s,
        t[2] = (i[2] * n + i[6] * r + i[10] * o + i[14]) * s,
        t
    }
    Qa.include({
        _registerDomEvents: function() {
            var t = this._panels.mapWrapper || this._containerDOM;
            _i(t, _l, this._handleDOMEvent, this),
            _i(t, ml, pl, this)
        },
        _removeDomEvents: function() {
            var t = this._panels.mapWrapper || this._containerDOM;
            vi(t, _l, this._handleDOMEvent),
            vi(t, ml, pl)
        },
        _handleDOMEvent: function(t) {
            if (t && "drop" === t.type) {
                t.stopPropagation(),
                t.preventDefault();
                var e = this._parseEvent(t, t.type);
                return e = F({}, e, {
                    dataTransfer: t.dataTransfer
                }),
                void this._fireEvent(t.type, e)
            }
            var i = this.options.clickTimeThreshold
              , n = t.type;
            if (!ji(n) || y.isTest || !Fi(this, this.options.mousemoveThrottleTime)) {
                var r = "mousedown" === n || "touchstart" === n && (!t.touches || 1 === t.touches.length);
                r && (this._domMouseDownTime = x(),
                this._domMouseDownView = this.getView());
                var o = "contextmenu" === n && function(t) {
                    if (!t._domMouseDownView)
                        return !0;
                    var e = t.getView()
                      , i = t._domMouseDownView;
                    return e.bearing !== i.bearing || e.pitch !== i.pitch
                }(this);
                if ("contextmenu" === n) {
                    xi(t);
                    var s = this._domMouseDownTime;
                    x() - s <= i && !o && this._fireDOMEvent(this, t, "dom:" + t.type)
                } else
                    this._fireDOMEvent(this, t, "dom:" + t.type);
                if (!this._ignoreEvent(t) && !this._isEventOutMap(t)) {
                    var a, h = !1;
                    if (r)
                        this._mouseDownTime = x();
                    else if ("click" === n || "touchend" === n || "contextmenu" === n) {
                        if (!this._mouseDownTime)
                            return;
                        var l = this._mouseDownTime;
                        if (delete this._mouseDownTime,
                        i < x() - l) {
                            if ("click" === n || "contextmenu" === n)
                                return
                        } else if ("contextmenu" === n) {
                            if (o)
                                return
                        } else
                            "touchend" === n && (h = !0)
                    }
                    h && (this._clickTime && x() - this._clickTime <= i ? (delete this._clickTime,
                    a = "dblclick",
                    this._fireDOMEvent(this, t, "dom:dblclick")) : (this._clickTime = x(),
                    a = "click",
                    this._fireDOMEvent(this, t, "dom:click"))),
                    this._ignoreEvent(t) || this._isEventOutMap(t) || (this._fireDOMEvent(this, t, n),
                    a && this._fireDOMEvent(this, t, a))
                }
            }
        },
        _ignoreEvent: function(t) {
            if (!t || !this._panels.control)
                return !1;
            var e, i = t.srcElement || t.target;
            if (i)
                for (; i && i !== this._containerDOM; ) {
                    if (i.className && i.className.indexOf && (0 <= i.className.indexOf("maptalks-control") || 0 <= i.className.indexOf("maptalks-ui") && e && !e.eventsPropagation))
                        return !0;
                    i = (e = i).parentNode
                }
            return !1
        },
        _isEventOutMap: function(t) {
            if (this.getPitch() > this.options.maxVisualPitch) {
                var e = Mi(this._getActualEvent(t), this._containerDOM);
                if (!this.getContainerExtent().contains(e))
                    return !0
            }
            return !1
        },
        _wrapTerrainData: function(t) {
            t.containerPoint && !t.terrain && (t.terrain = this._queryTerrainInfo(t.containerPoint))
        },
        _parseEvent: function(t, e) {
            if (!t)
                return null;
            var i = {
                domEvent: t
            };
            if ("keypress" !== e) {
                var n = this._getActualEvent(t);
                if (n && void 0 !== n.clientX) {
                    var r = Mi(n, this._containerDOM);
                    i = F(i, {
                        containerPoint: r,
                        viewPoint: this.containerPointToViewPoint(r)
                    });
                    var o = this.options.maxVisualPitch;
                    (this.getPitch() <= o || r.y >= this.height - this._getVisualHeight(o)) && (i = F(i, {
                        coordinate: this.containerPointToCoord(r),
                        point2d: this._containerPointToPoint(r)
                    }))
                }
            }
            return this._wrapTerrainData(i),
            i
        },
        _parseEventFromCoord: function(t) {
            var e = this.coordToContainerPoint(t);
            return {
                coordinate: t,
                containerPoint: e,
                viewPoint: this.containerPointToViewPoint(e),
                point2d: this.coordToPoint(t)
            }
        },
        _getActualEvent: function(t) {
            return t.touches && 0 < t.touches.length ? t.touches[0] : t.changedTouches && 0 < t.changedTouches.length ? t.changedTouches[0] : t
        },
        _fireDOMEvent: function(t, e, i) {
            var n = this;
            if (!this.isRemoved()) {
                var r = this._parseEvent(e, i);
                this._wrapTerrainData(r),
                ji(i) ? this.getRenderer().callInNextFrame(function() {
                    r.domEvent && r.domEvent._cancelBubble ? n._fireEvent("_" + i, r) : n._fireEvent(i, r)
                }) : this._fireEvent(i, r)
            }
        },
        _getEventParams: function(t) {
            var e = {
                domEvent: t
            }
              , i = t.touches && 0 < t.touches.length ? t.touches[0] : t.changedTouches && 0 < t.changedTouches.length ? t.changedTouches[0] : t;
            if (i) {
                var n = Mi(i, this._containerDOM);
                e.coordinate = this.containerPointToCoordinate(n),
                e.containerPoint = n,
                e.viewPoint = this.containerPointToViewPoint(n),
                e.pont2d = this._containerPointToPoint(n)
            }
            return this._wrapTerrainData(e),
            e
        }
    }),
    Qa.addOnLoadHook("_registerDomEvents"),
    Qa.include({
        isFullScreen: function() {
            return !!(document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement || document.fullscreenElement)
        },
        requestFullScreen: function(t) {
            return this._fireEvent("fullscreenstart"),
            this._requestFullScreen(t || this._containerDOM),
            this._fireEvent("fullscreenend"),
            this
        },
        cancelFullScreen: function() {
            return this._cancelFullScreen(),
            this._fireEvent("cancelfullscreen"),
            this
        },
        _requestFullScreen: function(t) {
            if (t.requestFullscreen)
                t.requestFullscreen();
            else if (t.mozRequestFullScreen)
                t.mozRequestFullScreen();
            else if (t.webkitRequestFullScreen)
                t.webkitRequestFullScreen();
            else if (t.msRequestFullScreen)
                t.msRequestFullScreen();
            else {
                var e = "fullscreen=1,status=no,resizable=yes,top=0,left=0,scrollbars=no,titlebar=no,menubar=no,location=no,toolbar=no,z-look=yes,width=" + (screen.availWidth - 8) + ",height=" + (screen.availHeight - 45);
                null !== window.open(location.href, "_blank", e) && (window.opener = null,
                window.close())
            }
        },
        _cancelFullScreen: function() {
            if (document.exitFullscreen)
                document.exitFullscreen();
            else if (document.mozCancelFullScreen)
                document.mozCancelFullScreen();
            else if (document.webkitCancelFullScreen)
                document.webkitCancelFullScreen();
            else {
                null !== window.open(location.href, "_blank", "fullscreen=no,status=yes,resizable=yes,scrollbars=no,titlebar=no,menubar=yes,location=yes,toolbar=yes,z-look=yes") && (window.opener = null,
                window.close())
            }
        }
    }),
    Qa.include({
        panTo: function(t, e, i) {
            if (void 0 === e && (e = {}),
            !t)
                return this;
            if (H(e) && (i = e,
            e = {}),
            t = new Rr(t),
            void 0 === e.animation || e.animation) {
                var n = this.getProjection().project(t);
                return this._panAnimation(n, e.duration, i)
            }
            return this.setCenter(t),
            this
        },
        _panTo: function(t, e) {
            return void 0 === e && (e = {}),
            void 0 === e.animation || e.animation ? this._panAnimation(t, e.duration) : (this.onMoveStart(),
            this._setPrjCenter(t),
            this.onMoveEnd(this._parseEventFromCoord(this.getCenter())),
            this)
        },
        panBy: function(t, e, i) {
            if (void 0 === e && (e = {}),
            !t)
                return this;
            if (H(e) && (i = e,
            e = {}),
            t = new dt(t),
            0 < this.getContainerExtent().ymin && 30 < t.y) {
                var n = t.y;
                t.y = 30,
                t.x = 30 * t.x / n,
                console.warn("offset is limited to panBy when pitch is above maxPitch")
            }
            if (void 0 === e.animation || e.animation) {
                t = t.multi(-1);
                var r = this._containerPointToPrj(new dt(this.width / 2 + t.x,this.height / 2 + t.y));
                this._panAnimation(r, e.duration, i)
            } else {
                this.onMoveStart(),
                this._offsetCenterByPixel(t);
                var o = this.containerPointToCoord(new dt(this.width / 2,this.height / 2));
                this.onMoveEnd(this._parseEventFromCoord(o))
            }
            return this
        },
        _panAnimation: function(t, e, i) {
            return this._animateTo({
                prjCenter: t
            }, {
                duration: e || this.options.panAnimationDuration
            }, i)
        }
    }),
    sa.fromJSON = function(t) {
        if (Array.isArray(t)) {
            for (var e = [], i = 0, n = t.length; i < n; i++) {
                var r = sa.fromJSON(t[i]);
                Array.isArray(t) ? e = e.concat(r) : e.push(r)
            }
            return e
        }
        return t && !t.feature ? jh.toGeometry(t) : (t.subType ? (o = sa.getJSONClass(t.subType).fromJSON(t),
        ut(t.feature.id) || o.setId(t.feature.id)) : (o = jh.toGeometry(t.feature),
        t.options && o.config(t.options)),
        t.symbol && o.setSymbol(t.symbol),
        t.infoWindow && o.setInfoWindow(t.infoWindow),
        o);
        var o
    }
    ,
    ca.fromJSON = function(t) {
        if (!t)
            return null;
        var e = t.type
          , i = ca.getJSONClass(e);
        if (!i || !i.fromJSON)
            throw new Error("unsupported layer type:" + e);
        return i.fromJSON(t)
    }
    ,
    Qa.include({
        JSON_VERSION: "1.0",
        toJSON: function(t) {
            t || (t = {});
            var e = {
                jsonVersion: this.JSON_VERSION,
                version: this.VERSION,
                extent: this.getExtent().toJSON()
            };
            e.options = this.config(),
            e.options.center = this.getCenter(),
            e.options.zoom = this.getZoom(),
            e.options.bearing = this.getBearing(),
            e.options.pitch = this.getPitch();
            var i = this.getBaseLayer();
            (ut(t.baseLayer) || t.baseLayer) && i && (e.baseLayer = i.toJSON(t.baseLayer));
            var n = {};
            t.clipExtent && (!0 === t.clipExtent ? n.clipExtent = this.getExtent() : n.clipExtent = t.clipExtent);
            var r = [];
            if (ut(t.layers) || t.layers && !Array.isArray(t.layers)) {
                for (var o = this.getLayers(), s = 0, a = o.length; s < a; s++)
                    if (o[s].toJSON) {
                        var h = F({}, _(t.layers) ? t.layers : {}, n);
                        r.push(o[s].toJSON(h))
                    }
                e.layers = r
            } else if (St(t.layers)) {
                for (var l = t.layers, u = 0; u < l.length; u++) {
                    var c = l[u]
                      , d = this.getLayer(c.id);
                    if (d.toJSON) {
                        var f = F({}, c.options, n);
                        r.push(d.toJSON(f))
                    }
                }
                e.layers = r
            } else
                e.layers = [];
            return e
        }
    }),
    Qa.fromJSON = function(t, e, i) {
        if (!t || !e)
            return null;
        i || (i = {});
        var n = new Qa(t,e.options);
        if (ut(i.baseLayer) || i.baseLayer) {
            var r = ca.fromJSON(e.baseLayer);
            r && n.setBaseLayer(r)
        }
        if (ut(i.layers) || i.layers) {
            for (var o = [], s = e.layers, a = 0; a < s.length; a++) {
                var h = ca.fromJSON(s[a]);
                o.push(h)
            }
            n.addLayer(o)
        }
        return n
    }
    ,
    Qa.include({
        computeLength: function(t, e) {
            if (!this.getProjection())
                return null;
            var i = new Rr(t)
              , n = new Rr(e);
            return i.equals(n) ? 0 : this.getProjection().measureLength(i, n)
        },
        computeGeometryLength: function(t) {
            return t._computeGeodesicLength(this.getProjection())
        },
        computeGeometryArea: function(t) {
            return t._computeGeodesicArea(this.getProjection())
        },
        identify: function(e, t) {
            var i = new Rr((e = e || {}).coordinate);
            return this._identify(e, t, function(t) {
                return t.identify(i, e)
            })
        },
        identifyAtPoint: function(n, t) {
            var r = n.includeInternals
              , o = n.tolerance
              , e = new dt((n = n || {}).containerPoint)
              , s = this.containerPointToCoord(e);
            return this._identify(n, t, function(t) {
                var e, i = n.containerPoint;
                if (r && !ut(t.options.geometryEventTolerance) && (n.tolerance = n.tolerance || 0,
                n.tolerance += t.options.geometryEventTolerance),
                t._hasGeoListeners && r && 0 <= n.eventTypes.indexOf("mousemove") && !t._hasGeoListeners(n.eventTypes))
                    return [];
                (e = t.identifyAtPoint ? t.identifyAtPoint(i, n) : s && t.identify ? t.identify(s, n) : [],
                r && (ut(o) ? delete n.tolerance : n.tolerance = o),
                e && e.length) || (t.fire("identifyempty", n),
                t.getLayers && H(t.getLayers) && (t.getLayers() || []).filter(function(t) {
                    return t
                }).forEach(function(t) {
                    t.fire("identifyempty", n)
                }));
                return e
            })
        },
        _identify: function(t, e, i) {
            var n = t.layers;
            if (!St(n))
                return this;
            for (var r = t.eventTypes, o = [], s = 0, a = n.length; s < a; s++)
                P(n[s]) ? o.push(this.getLayer(n[s])) : o.push(n[s]);
            r && (o = o.filter(function(t) {
                return !t._hasGeoListeners || t._hasGeoListeners(r)
            }));
            for (var h = [], l = o.length - 1; 0 <= l && !(t.count && h.length >= t.count); l--) {
                var u = o[l];
                if (u && u.getMap() && (t.includeInvisible || u.isVisible()) && (t.includeInternals || !(0 <= u.getId().indexOf(g)))) {
                    var c = i(u)
                      , d = u.getId();
                    if (c)
                        if (Array.isArray(c)) {
                            for (var f = 0; f < c.length; f++)
                                c[f] && !c[f].getLayer && ut(c[f].layer) && (c[f].layer = d);
                            yt(h, c)
                        } else
                            !c.getLayer && ut(c.layer) && (c.layer = d),
                            h.push(c)
                }
            }
            return e.call(this, h),
            this
        }
    }),
    Qa.include({
        _zoom: function(t, e) {
            this.options.zoomable && !this.isZooming() && (e = this._checkZoomOrigin(e),
            t = this._checkZoom(t),
            this.onZoomStart(t, e),
            this._frameZoom = this.getZoom(),
            this.onZoomEnd(t, e))
        },
        _zoomAnimation: function(t, e, i) {
            this.options.zoomable && !this.isZooming() && (t = this._checkZoom(t),
            this.getZoom() !== t && (e = this._checkZoomOrigin(e),
            this._startZoomAnim(t, e, i)))
        },
        _checkZoomOrigin: function(t) {
            return t && !this.options.zoomInCenter || (t = new dt(this.width / 2,this.height / 2)),
            this.options.zoomOrigin && (t = new dt(this.options.zoomOrigin)),
            t
        },
        _startZoomAnim: function(t, e, i) {
            ut(i) && (i = 1);
            var n = this._getResolution(this._startZoomVal) / this._getResolution(t)
              , r = this.options.zoomAnimationDuration * Math.abs(n - i) / Math.abs(n - 1);
            this._frameZoom = this._startZoomVal,
            this._animateTo({
                zoom: t,
                around: e
            }, {
                continueOnViewChanged: !0,
                duration: r
            })
        },
        onZoomStart: function(t, e) {
            this.options.zoomable && !this.isZooming() && (this._mapAnimPlayer && this._stopAnim(this._mapAnimPlayer),
            delete this.cameraZenithDistance,
            this._zooming = !0,
            this._startZoomVal = this.getZoom(),
            this._startZoomCoord = this._containerPointToPrj(e),
            this._fireEvent("zoomstart", {
                from: this._startZoomVal,
                to: t
            }))
        },
        onZooming: function(t, e, i) {
            if (this.options.zoomable && this._frameZoom !== t) {
                ut(i) && (i = 1),
                this._zoomTo(t, e);
                var n = this.getResolution(t)
                  , r = this.getResolution(this._startZoomVal) / n / i
                  , o = this._prjToContainerPoint(this._startZoomCoord, this._startZoomVal)
                  , s = this.getViewPoint();
                if (!this.isRotating() && !o.equals(e) && 1 !== r) {
                    var a = this.getPitch()
                      , h = o._sub(e)._multi(1 / (1 - r));
                    a && (h.y /= Math.cos(a * Math.PI / 180)),
                    e = e.add(h)
                }
                var l = {
                    view: [r, 0, 0, r, (e.x - s.x) * (1 - r), (e.y - s.y) * (1 - r)]
                }
                  , u = this.getDevicePixelRatio();
                1 !== u && (e = e.multi(u)),
                l.container = [r, 0, 0, r, e.x * (1 - r), e.y * (1 - r)],
                this._fireEvent("zooming", {
                    from: this._startZoomVal,
                    to: t,
                    origin: e,
                    matrix: l
                }),
                this._frameZoom = t
            }
        },
        onZoomEnd: function(t, e) {
            if (this.options.zoomable) {
                var i = this._startZoomVal;
                this._zoomTo(t, e),
                this._zooming = !1,
                this._getRenderer().onZoomEnd(),
                this._suppressRecenter || this._recenterOnTerrain(),
                this._fireEvent("zoomend", {
                    from: i,
                    to: t
                }),
                this._verifyExtent(this._getPrjCenter()) || this._panTo(this._prjMaxExtent.getCenter())
            }
        },
        _zoomTo: function(t, e) {
            if (this._zoomLevel = t,
            this._calcMatrices(),
            e) {
                var i = this._containerPointToPoint(e)._sub(this._prjToPoint(this._getPrjCenter()));
                this._setPrjCoordAtOffsetToCenter(this._startZoomCoord, i)
            }
        },
        _checkZoom: function(t) {
            var e = this.getMaxZoom()
              , i = this.getMinZoom();
            return t < i && (t = i),
            e < t && (t = e),
            t
        }
    });
    var Dl, Il, zl, jl, Fl, Gl, Hl, Bl, Nl, Zl, Wl, Vl, Ul, Jl = Math.PI / 180, ql = new Rr(0,0), Xl = new dt(0,0), Yl = [0, -1, 0], Ql = [];
    function Kl() {
        return bl(new Array(16))
    }
    Qa.include({
        getFov: function() {
            return this._fov || (this._fov = .6435011087932844),
            this._fov / Jl
        },
        setFov: function(t) {
            if (this.isZooming())
                return this;
            if (t = Math.max(.01, Math.min(60, t)),
            this._fov === t)
                return this;
            var e = this.getFov();
            return this._fov = t * Jl,
            this._calcMatrices(),
            this._renderLayers(),
            this._fireEvent("fovchange", {
                from: e,
                to: this.getFov()
            }),
            this
        },
        getBearing: function() {
            return this._angle ? -this._angle / Jl : 0
        },
        setBearing: function(t) {
            return this._mapAnimPlayer && this._stopAnim(this._mapAnimPlayer),
            this._setBearing(t)
        },
        _setBearing: function(t) {
            if ($.ie9)
                throw new Error("map can't rotate in IE9.");
            var e = -Mt(t, -180, 180) * Jl;
            if (this._angle === e)
                return this;
            var i = this.getBearing();
            return this._fireEvent("rotatestart", {
                from: i,
                to: e
            }),
            this._angle = e,
            this._calcMatrices(),
            this._renderLayers(),
            this._fireEvent("rotate", {
                from: i,
                to: e
            }),
            this._fireEvent("rotateend", {
                from: i,
                to: e
            }),
            this
        },
        getPitch: function() {
            return this._pitch ? this._pitch / Math.PI * 180 : 0
        },
        setPitch: function(t) {
            return this._mapAnimPlayer && this._stopAnim(this._mapAnimPlayer),
            this._setPitch(t)
        },
        _setPitch: function(t) {
            if ($.ie9)
                throw new Error("map can't tilt in IE9.");
            var e = Tt(t, 0, this.options.maxPitch) * Jl;
            if (this._pitch === e)
                return this;
            var i = this.getPitch();
            return this._fireEvent("pitchstart", {
                from: i,
                to: e
            }),
            this._pitch = e,
            this._calcMatrices(),
            this._renderLayers(),
            this._fireEvent("pitch", {
                from: i,
                to: e
            }),
            this._fireEvent("pitchend", {
                from: i,
                to: e
            }),
            this
        },
        setCameraMovements: function(u, c) {
            var d = this;
            if (!Array.isArray(u) || !u.length)
                return this;
            if (this.setView({
                center: u[0].center,
                zoom: u[0].zoom,
                pitch: u[0].pitch,
                bearing: u[0].bearing
            }),
            1 === u.length)
                return this;
            var f = 1
              , g = function(t) {
                if ("finished" === t.state.playState) {
                    ++f === u.length - 1 && (g = null);
                    var e = u[f];
                    e.duration = e.timestamp - u[f - 1].timestamp,
                    c && c.autoRotate && (e.bearing = (i = u[f - 1].center,
                    n = e.center,
                    r = w(i[0]),
                    o = w(n[0]),
                    s = w(i[1]),
                    a = w(n[1]),
                    h = Math.sin(o - r) * Math.cos(a),
                    l = Math.cos(s) * Math.sin(a) - Math.sin(s) * Math.cos(a) * Math.cos(o - r),
                    C(Math.atan2(h, l)))),
                    d._setCameraMovement(e, g)
                }
                var i, n, r, o, s, a, h, l
            };
            2 === u.length && (g = null);
            var t = this.getBearing();
            this._setCameraMovement(et({
                bearing: t
            }, u[f], {
                duration: u[f].timestamp - u[f - 1].timestamp
            }), g);
            return {
                play: function() {
                    d._animPlayer.play()
                },
                pause: function() {
                    d._animPlayer.pause()
                },
                cancel: function() {
                    d._animPlayer.cancel()
                },
                finish: function() {
                    d._animPlayer.finish()
                },
                reverse: function() {
                    d._animPlayer.reverse()
                }
            }
        },
        _setCameraMovement: function(t, e) {
            this.animateTo({
                zoom: t.zoom,
                center: t.center,
                pitch: t.pitch,
                bearing: t.bearing
            }, {
                duration: t.duration,
                easing: "out"
            }, e)
        },
        setCameraOrientation: function(t) {
            var e = t.position
              , i = t.pitch
              , n = t.bearing
              , r = this.getFitZoomForCamera(e, i)
              , o = r.zoom
              , s = r.cameraToGroundDistance
              , a = Math.sin(i * Jl) * s
              , h = Mt(n, -180, 180) * Jl
              , l = this.getGLRes()
              , u = new Rr(e[0],e[1])
              , c = this.coordToPointAtRes(u, l)
              , d = new dt(0,0);
            d.x = c.x + a * Math.sin(h),
            d.y = c.y + a * Math.cos(h);
            var f = this._pointToPrjAtRes(d, this.getGLRes());
            return this._setPrjCenter(f),
            this.setView({
                bearing: n,
                pitch: i,
                zoom: o
            }),
            this
        },
        setCameraPosition: function(t) {
            var e = this.getGLRes()
              , i = this.coordToPointAtRes(t, e);
            i.z = this.altitudeToPoint(t.z || 0, e);
            var n = this.getCenter()
              , r = this.coordToPointAtRes(n, e);
            r.z = this.altitudeToPoint(n.z, e);
            var o = Tl([], i.toArray(), r.toArray());
            Ml(this.cameraUp || [0, 0, 0], 0, 0, 1),
            this._pitch = Ol(o, this.cameraUp),
            Ml(Ql, o[0], o[1], 0),
            this._angle = -Ol(Ql, Yl),
            this._zoomLevel = this.getFitZoomForCamera(t, this._pitch).zoom,
            this._calcMatrices()
        },
        getFitZoomForCamera: function(t, e) {
            var i = (Array.isArray(t) ? t[2] : t.z) * this._meterToGLPoint
              , n = (this.centerAltitude || 0) * this._meterToGLPoint
              , r = e * Jl
              , o = (i - n) / Math.cos(r)
              , s = o + n;
            return {
                zoom: this._getFitZoomForDistance(s),
                cameraToGroundDistance: o
            }
        },
        _getFitZoomForDistance: function(t) {
            for (var e = t * this._getFovRatio() * 2 / (this.height || 1) * this.getGLRes(), i = this._getResolutions(), n = 0; n < i.length - 1; n++) {
                if (i[n] === e)
                    return n;
                if (i[n + 1] === e)
                    return n + 1;
                if (e < i[n] && e > i[n + 1])
                    return (n = (e - i[n]) / (i[n + 1] - i[n]) + n) - 1
            }
            return n
        },
        isTransforming: function() {
            return !(!this._pitch && !this._angle)
        },
        getFrustumAltitude: function() {
            return this._frustumAltitude
        },
        _calcFrustumAltitude: function() {
            var t = 90 - this.getPitch()
              , e = this.getFov() / 2
              , i = this.cameraPosition ? this.cameraPosition[2] : 0;
            if (e <= t)
                return i;
            e = Math.PI * e / 180;
            var n = new dt(this.cameraPosition).distanceTo(new dt(this.cameraLookAt))
              , r = i * Math.tan(2 * e);
            return i + Math.tan(e) * (n + r)
        },
        _pointToContainerPoint: function(t, e, i, n) {
            void 0 === i && (i = 0);
            var r = this._getResolution(e);
            return this._pointAtResToContainerPoint(t, r, i, n)
        },
        _pointAtResToContainerPoint: function(t, e, i, n) {
            void 0 === i && (i = 0),
            n || (n = new dt(0,0)),
            t = this._pointAtResToPoint(t, e, n);
            var r, o = this.isTransforming();
            return o || i || (r = this._prjToPoint(this._getPrjCenter(), void 0, ql)),
            this._toContainerPoint(n, o, i, r),
            n
        },
        _pointsAtResToContainerPoints: function(t, e, i, n) {
            void 0 === i && (i = []),
            void 0 === n && (n = []);
            var r = this.getPitch()
              , o = this.getBearing()
              , s = e / this._getResolution();
            if (0 === r && 0 === o && !function(t) {
                if (G(t))
                    return 0 !== t;
                if (Array.isArray(t) && 0 < t.length)
                    for (var e = 0, i = t.length; e < i; e++)
                        if (G(t[e]) && 0 !== t[e])
                            return !0;
                return !1
            }(i)) {
                var a = this._get2DExtent()
                  , h = a.xmin
                  , l = a.ymin
                  , u = a.xmax
                  , c = a.ymax;
                if (h < u && l < c) {
                    for (var d = this.getSize(), f = d.width, g = d.height, p = (u - h) / f, m = (c - l) / g, _ = 0, v = t.length; _ < v; _++)
                        if (t[_]) {
                            var y = n[_];
                            y.x = t[_].x,
                            y.y = t[_].y,
                            y._multi(s),
                            y.x = (y.x - h) * p,
                            y.y = g - (y.y - l) * m
                        } else
                            n[_] = null;
                    return n
                }
            }
            for (var x = Array.isArray(i), w = this.isTransforming(), C = this._prjToPoint(this._getPrjCenter(), void 0, ql), b = 0, P = t.length; b < P; b++)
                if (t[b]) {
                    var M = n[b];
                    M.x = t[b].x,
                    M.y = t[b].y,
                    M._multi(s);
                    var T = x ? i[b] || 0 : i;
                    this._toContainerPoint(M, w, T, C)
                } else
                    n[b] = null;
            return n
        },
        _toContainerPoint: (Ul = [0, 0, 0],
        function(t, e, i, n) {
            var r = this.width / 2
              , o = this.height / 2;
            if (e || i) {
                this._altitudeScale || (this._altitudeScale = this.altitudeToPoint(100, this.getGLRes()) / 100);
                var s = this._glScale;
                Ml(Ul, t.x * s, t.y * s, i * this._altitudeScale);
                var a = this._projIfBehindCamera(Ul, this.cameraPosition, this.cameraForward);
                Ll(a, a, this.projViewMatrix),
                t.x = a[0] * r + r,
                t.y = -a[1] * o + o
            } else
                t._sub(n.x, n.y),
                t.set(t.x, -t.y),
                t._add(r, o)
        }
        ),
        _projIfBehindCamera: (Zl = new Array(3),
        Wl = new Array(3),
        Vl = new Array(3),
        function(t, e, i) {
            Tl(Zl, t, e);
            var n, r, o, s, a, h, l = Rl(i, Zl);
            return l <= 0 && (a = i,
            h = 1.01 * l,
            (s = Wl)[0] = a[0] * h,
            s[1] = a[1] * h,
            s[2] = a[2] * h,
            n = t,
            r = e,
            o = Tl(Vl, Zl, Wl),
            n[0] = r[0] + o[0],
            n[1] = r[1] + o[1],
            n[2] = r[2] + o[2]),
            t
        }
        ),
        _containerPointToPoint: function(t, e, i) {
            var n = this._getResolution(e);
            return this._containerPointToPointAtRes(t, n, i)
        },
        _containerPointToPointAtRes: (Hl = [0, 0, 0],
        Bl = [0, 0, 0, 1],
        Nl = [0, 0, 0, 1],
        function(t, e, i) {
            if (this.isTransforming()) {
                var n = this.width / 2 || 1
                  , r = this.height / 2 || 1;
                Ml(Hl, (t.x - n) / n, (r - t.y) / r, 0),
                Ml(Bl, Hl[0], Hl[1], 0),
                Ml(Nl, Hl[0], Hl[1], 1),
                Bl[3] = Nl[3] = 1,
                Ll(Bl, Bl, this.projViewMatrixInverse),
                Ll(Nl, Nl, this.projViewMatrixInverse);
                var o = Bl[0]
                  , s = Nl[0]
                  , a = Bl[1]
                  , h = Nl[1]
                  , l = Bl[2]
                  , u = Nl[2]
                  , c = l === u ? 0 : (0 - l) / (u - l)
                  , d = Pt(o, s, c)
                  , f = Pt(a, h, c);
                return i ? (i.x = d,
                i.y = f) : i = new dt(d,f),
                i._multi(1 / this._glScale),
                this._getResolution() === e ? i : this._pointToPointAtRes(i, e, i)
            }
            var g = this._prjToPointAtRes(this._getPrjCenter(), e, i)
              , p = this._getResolution() / e
              , m = p * (t.x - this.width / 2)
              , _ = p * (t.y - this.height / 2);
            return g._add(m, -_)
        }
        ),
        _calcMatrices: (Gl = Kl(),
        function() {
            delete this._mapRes,
            delete this._mapGlRes,
            delete this._mapExtent2D,
            delete this._mapGlExtent2D;
            var t = this.getSize()
              , e = t.width || 1
              , i = t.height || 1;
            this._glScale = this.getGLScale();
            var n = this._getCameraWorldMatrix()
              , r = this.getFov() * Math.PI / 180
              , o = this._getCameraFar(r, this.getPitch());
            this.cameraFar = o,
            this.cameraNear = this.cameraCenterDistance / 20;
            var s = this.projMatrix || Kl();
            vl(s, r, e / i, this.cameraNear, o),
            this.projMatrix = s,
            this.viewMatrix = Cl(this.viewMatrix || Kl(), n),
            this.projViewMatrix = wl(this.projViewMatrix || Kl(), s, this.viewMatrix),
            this._calcCascadeMatrixes(),
            this.projViewMatrixInverse = wl(this.projViewMatrixInverse || Kl(), n, Cl(Gl, s)),
            this.domCssMatrix = this._calcDomMatrix(),
            this._frustumAltitude = this._calcFrustumAltitude(),
            this._mapRes = this._getResolution(),
            this._mapGlRes = this.getGLRes(),
            this._mapExtent2D = this._get2DExtent(),
            this._mapGlExtent2D = this._get2DExtentAtRes(this._mapGlRes)
        }
        ),
        _getCameraFar: function(t, e) {
            var i = this.cameraCenterDistance = kl(this.cameraPosition, this.cameraLookAt)
              , n = i
              , r = (this.options.cameraInfiniteFar ? 10 : 4) * i;
            if (0 < e && (e = e * Math.PI / 180,
            2 / Math.PI - e > t / 2)) {
                var o = Math.tan(t / 2)
                  , s = Math.tan(e);
                r = Math.max(i * o / (1 / s - o), r)
            }
            return (n += r) + 1
        },
        _calcCascadeMatrixes: function() {
            var l = Kl();
            function o(t, e, i) {
                var n = this.width
                  , r = this.height
                  , o = this.getFov() * Math.PI / 180
                  , s = this._getCameraFar(o, e)
                  , a = this.cameraCenterDistance;
                s = a + (s - a) / Math.cos((90 - e) * Math.PI / 180) * Math.cos((90 - t) * Math.PI / 180),
                vl(l, o, n / r, .1, s);
                var h = this.viewMatrix;
                return wl(i, l, h)
            }
            return function() {
                var t = this.getPitch()
                  , e = this.options.cascadePitches[0]
                  , i = this.options.cascadePitches[1]
                  , n = this.cascadeFrustumMatrix0 = this.cascadeFrustumMatrix0 || Kl()
                  , r = this.cascadeFrustumMatrix1 = this.cascadeFrustumMatrix1 || Kl();
                e < t ? o.call(this, t, e, n) : Pl(this.cascadeFrustumMatrix0, this.projViewMatrix),
                i < t ? o.call(this, t, i, r) : Pl(this.cascadeFrustumMatrix1, this.cascadeFrustumMatrix0)
            }
        }(),
        _calcDomMatrix: (Il = Kl(),
        zl = Kl(),
        jl = [1, -1, 1],
        Fl = [0, 0, 0],
        function() {
            var t, e, i, n, r, o, s, a, h, l, u, c, d, f, g, p, m, _, v, y, x, w, C, b, P, M, T = this.width || 1, S = this.height || 1, E = .5 / Math.tan(this._fov / 2) * S;
            return xl(Il, this.projMatrix, jl),
            yl(Il, Il, Ml(Fl, 0, 0, -E)),
            this._pitch && (e = t = Il,
            i = this._pitch,
            n = Math.sin(i),
            r = Math.cos(i),
            o = e[4],
            s = e[5],
            a = e[6],
            h = e[7],
            l = e[8],
            u = e[9],
            c = e[10],
            d = e[11],
            e !== t && (t[0] = e[0],
            t[1] = e[1],
            t[2] = e[2],
            t[3] = e[3],
            t[12] = e[12],
            t[13] = e[13],
            t[14] = e[14],
            t[15] = e[15]),
            t[4] = o * r + l * n,
            t[5] = s * r + u * n,
            t[6] = a * r + c * n,
            t[7] = h * r + d * n,
            t[8] = l * r - o * n,
            t[9] = u * r - s * n,
            t[10] = c * r - a * n,
            t[11] = d * r - h * n),
            this._angle && (g = f = Il,
            p = this._angle,
            m = Math.sin(p),
            _ = Math.cos(p),
            v = g[0],
            y = g[1],
            x = g[2],
            w = g[3],
            C = g[4],
            b = g[5],
            P = g[6],
            M = g[7],
            g !== f && (f[8] = g[8],
            f[9] = g[9],
            f[10] = g[10],
            f[11] = g[11],
            f[12] = g[12],
            f[13] = g[13],
            f[14] = g[14],
            f[15] = g[15]),
            f[0] = v * _ + C * m,
            f[1] = y * _ + b * m,
            f[2] = x * _ + P * m,
            f[3] = w * _ + M * m,
            f[4] = C * _ - v * m,
            f[5] = b * _ - y * m,
            f[6] = P * _ - x * m,
            f[7] = M * _ - w * m),
            bl(zl),
            xl(zl, zl, Ml(Fl, T / 2, -S / 2, 1)),
            wl(this.domCssMatrix || Kl(), zl, Il)
        }
        ),
        _getFovZ: function(t) {
            var e = this.getGLScale(t)
              , i = this._getFovRatio();
            return e * (this.height || 1) / 2 / i
        },
        _getCameraWorldMatrix: (Dl = {},
        function() {
            var t = this.getGLRes();
            this._meterToGLPoint || (this._meterToGLPoint = this.distanceToPointAtRes(100, 0, t).x / 100);
            var e = this._prjToPointAtRes(this._prjCenter, t, Xl)
              , i = this.getCenter().z
              , n = (void 0 !== i ? i : this.centerAltitude || 0) * this._meterToGLPoint;
            this.cameraLookAt = Ml(this.cameraLookAt || [0, 0, 0], e.x, e.y, n);
            var r = this.getPitch() * Jl
              , o = this.getBearing() * Jl
              , s = this._getFovZ()
              , a = (void 0 === this.cameraZenithDistance ? s : this.cameraZenithDistance) - n
              , h = a * Math.cos(r)
              , l = Math.sin(r) * a
              , u = e.x - l * Math.sin(o)
              , c = e.y - l * Math.cos(o);
            this.cameraPosition = Ml(this.cameraPosition || [0, 0, 0], u, c, h + n),
            this.cameraToCenterDistance = s;
            var d, f, g, p, m, _, v, y = l || 1, x = this.cameraUp = 0 < this.getPitch() ? Ml(this.cameraUp || [0, 0, 0], 0, 0, 1) : Ml(this.cameraUp || [0, 0, 0], Math.sin(o) * y, Math.cos(o) * y, 0), w = this.cameraWorldMatrix = this.cameraWorldMatrix || Kl();
            d = w,
            f = this.cameraPosition,
            g = this.cameraLookAt,
            p = x,
            m = [0, 0, 0],
            _ = [0, 0, 0],
            Tl(v = [0, 0, 0], f, g),
            0 === Sl(v) && (v[2] = 1),
            El(v, v),
            Al(m, p, v),
            0 === Sl(v) && (1 === Math.abs(p[2]) ? v[0] += 1e-4 : v[2] += 1e-4,
            El(v, v),
            Al(m, p, v)),
            El(m, m),
            Al(_, v, m),
            d[0] = m[0],
            d[4] = _[0],
            d[8] = v[0],
            d[1] = m[1],
            d[5] = _[1],
            d[9] = v[1],
            d[2] = m[2],
            d[6] = _[2],
            d[10] = v[2];
            var C, b, P, M, T, S, E, R, A, k, O, L, D, I, z, j, F, G, H, B, N, Z, W, V, U, J, q, X, Y, Q, K, $, tt, et, it = this.cameraForward || [0, 0, 0];
            return Tl(it, this.cameraLookAt, this.cameraPosition),
            this.cameraForward = El(it, it),
            C = Dl,
            M = (b = w)[0],
            T = b[4],
            S = b[8],
            E = b[1],
            R = b[5],
            A = b[9],
            k = b[2],
            O = b[6],
            L = b[10],
            0 < (D = M + R + L) ? (P = .5 / Math.sqrt(D + 1),
            C.w = .25 / P,
            C.x = (O - A) * P,
            C.y = (S - k) * P,
            C.z = (E - T) * P) : R < M && L < M ? (P = 2 * Math.sqrt(1 + M - R - L),
            C.w = (O - A) / P,
            C.x = .25 * P,
            C.y = (T + E) / P,
            C.z = (S + k) / P) : L < R ? (P = 2 * Math.sqrt(1 + R - M - L),
            C.w = (S - k) / P,
            C.x = (T + E) / P,
            C.y = .25 * P,
            C.z = (A + O) / P) : (P = 2 * Math.sqrt(1 + L - M - R),
            C.w = (E - T) / P,
            C.x = (S + k) / P,
            C.y = (A + O) / P,
            C.z = .25 * P),
            z = w,
            j = (I = Dl).x,
            F = I.y,
            G = I.z,
            H = I.w,
            W = j * (B = j + j),
            V = j * (N = F + F),
            U = j * (Z = G + G),
            J = F * N,
            q = F * Z,
            X = G * Z,
            Y = H * B,
            Q = H * N,
            K = H * Z,
            z[0] = 1 - (J + X),
            z[4] = V - K,
            z[8] = U + Q,
            z[1] = V + K,
            z[5] = 1 - (W + X),
            z[9] = q - Y,
            z[2] = U - Q,
            z[6] = q + Y,
            z[10] = 1 - (W + J),
            z[3] = 0,
            z[7] = 0,
            z[11] = 0,
            z[12] = 0,
            z[13] = 0,
            z[14] = 0,
            z[15] = 1,
            $ = w,
            tt = this.cameraPosition,
            (et = $)[12] = tt[0],
            et[13] = tt[1],
            et[14] = tt[2],
            w
        }
        ),
        updateCenterAltitude: function() {
            this.getRenderer().setToRedraw(),
            !this.centerAltitude && this._hasAltitudeLayer() && (this.centerAltitude = 0),
            this._recenterOnTerrain()
        },
        _recenterOnTerrain: function() {
            if (void 0 !== this.centerAltitude && void 0 === this._centerZ) {
                var t = this._queryTerrainByProjCoord(this._prjCenter);
                ut(t) && this._hasAltitudeLayer() && (t = this.centerAltitude);
                var e = t || 0
                  , i = this.getPitch() * Jl
                  , n = this.getBearing() * Jl
                  , r = (e - this.centerAltitude) * this._meterToGLPoint
                  , o = this._getFovZ()
                  , s = (void 0 === this.cameraZenithDistance ? o : this.cameraZenithDistance) - this.centerAltitude * this._meterToGLPoint - r / Math.cos(i)
                  , a = this.cameraPosition
                  , h = Math.sin(i) * s
                  , l = Xl;
                l.x = a[0] + h * Math.sin(n),
                l.y = a[1] + h * Math.cos(n);
                var u = e * this._meterToGLPoint;
                this.cameraZenithDistance = (a[2] - u) / Math.cos(i) + u,
                this.centerAltitude = e;
                var c = this.pointAtResToCoordinate(l, this.getGLRes(), ql);
                this._eventSilence = !0,
                this._suppressRecenter = !0,
                this.setCenter(c),
                delete this._suppressRecenter,
                delete this._eventSilence,
                ut(t) && delete this.centerAltitude
            }
        },
        _queryTerrainByProjCoord: function(t) {
            for (var e = this._getLayers(), i = 0; i < e.length; i++)
                if (e[i].queryTerrainByProjCoord)
                    return e[i].queryTerrainByProjCoord(t)[0];
            return 0
        },
        _hasAltitudeLayer: function() {
            for (var t = this._getLayers(), e = 0; e < t.length; e++)
                if (t[e].getTerrainLayer && t[e].getTerrainLayer())
                    return !0;
            return !1
        },
        _queryTerrainInfo: function(t) {
            for (var e = this._getLayers() || [], i = 0; i < e.length; i++) {
                var n = e[i];
                if (t && n && n.queryTerrainAtPoint && n.getTerrainLayer && n.getTerrainLayer()) {
                    var r = n.queryTerrainAtPoint(t);
                    if (r)
                        return {
                            coordinate: r,
                            altitude: r.z
                        };
                    break
                }
            }
            return null
        },
        _getFovRatio: function() {
            var t = this.getFov();
            return Math.tan(t / 2 * Jl)
        },
        _renderLayers: function() {
            this.isInteracting() || this._getLayers().forEach(function(t) {
                if (t) {
                    var e = t._getRenderer();
                    e && e.setToRedraw && e.setToRedraw()
                }
            })
        }
    }),
    Qa.include({
        _onViewChange: function(t) {
            this._viewHistory || (this._viewHistory = [],
            this._viewHistoryPointer = 0);
            for (var e = this._getCurrentView(), i = this._viewHistory.length - 1; 0 <= i; i--)
                if (Ft(t, this._viewHistory[i]))
                    return this._viewHistoryPointer = i,
                    void this._fireViewChange(e, t);
            this._viewHistoryPointer < this._viewHistory.length - 1 && this._viewHistory.splice(this._viewHistoryPointer + 1),
            this._viewHistory.push(t);
            var n = this.options.viewHistoryCount;
            0 < n && this._viewHistory.length > n && this._viewHistory.splice(0, this._viewHistory.length - n),
            this._viewHistoryPointer = this._viewHistory.length - 1,
            this._fireViewChange(e, t)
        },
        zoomToPreviousView: function(t) {
            if (void 0 === t && (t = {}),
            !this.hasPreviousView())
                return null;
            var e = this._viewHistory[--this._viewHistoryPointer];
            return this._zoomToView(e, t),
            e
        },
        hasPreviousView: function() {
            return !(!this._viewHistory || 0 === this._viewHistoryPointer)
        },
        zoomToNextView: function(t) {
            if (void 0 === t && (t = {}),
            !this.hasNextView())
                return null;
            var e = this._viewHistory[++this._viewHistoryPointer];
            return this._zoomToView(e, t),
            e
        },
        hasNextView: function() {
            return !(!this._viewHistory || this._viewHistoryPointer === this._viewHistory.length - 1)
        },
        _zoomToView: function(e, t) {
            var i = this
              , n = this.getView();
            t.animation ? this._animateTo(e, {
                duration: t.duration
            }, function(t) {
                "finished" === t.state.playState && i._fireViewChange(n, e)
            }) : (this.setView(e),
            this._fireViewChange(n, e))
        },
        getViewHistory: function() {
            return this._viewHistory
        },
        _fireViewChange: function(t, e) {
            this._fireEvent("viewchange", {
                old: t,
                new: e
            }),
            this._insertUICollidesQueue()
        },
        _getCurrentView: function() {
            return this._viewHistory ? this._viewHistory[this._viewHistoryPointer] : null
        }
    }),
    Qa.mergeOptions({
        viewHistory: !0,
        viewHistoryCount: 10
    });
    var $l = new br;
    Qa.include({
        getCollisionIndex: function() {
            return this._collisionIndex || this.createCollisionIndex(),
            this._collisionIndex || this.createCollisionIndex()
        },
        createCollisionIndex: function() {
            return this.clearCollisionIndex(),
            this._collisionIndex = new br,
            this._collisionIndex
        },
        clearCollisionIndex: function() {
            return this.collisionFrameTime = 0,
            this._collisionIndex && this._collisionIndex.clear(),
            this
        },
        _insertUICollidesQueue: function() {
            return this._uiCollidesQueue || (this._uiCollidesQueue = []),
            this._uiCollidesQueue.push(1),
            this
        },
        uiCollides: function() {
            if (!this.uiList || 0 === this.uiList.length || !this._uiCollidesQueue || 0 === this._uiCollidesQueue.length)
                return this;
            var t = $l;
            t.clear();
            for (var e = this.uiList, i = 0, n = e.length; i < n; i++) {
                var r = e[i]
                  , o = r.options
                  , s = o.collisionBufferSize;
                if (o.collision) {
                    var a = r.getDOM();
                    if (r.isVisible() && a && a.getBoundingClientRect) {
                        r.bbox || (r.bbox = [0, 0, 0, 0]);
                        var h = a.getBoundingClientRect()
                          , l = h.x
                          , u = h.y
                          , c = h.width
                          , d = h.height;
                        if (0 === c || 0 === d) {
                            var f = r.getSize();
                            f && (c = f.width,
                            d = f.height)
                        }
                        var g = l - s
                          , p = l + c + s
                          , m = u - s
                          , _ = u + d + s;
                        r.bbox[0] = g,
                        r.bbox[1] = m,
                        r.bbox[2] = p,
                        r.bbox[3] = _,
                        t.collides(r.bbox) ? r._collidesEffect(!1) : (t.insertBox(r.bbox),
                        r._collidesEffect(!0))
                    }
                }
            }
            return this._uiCollidesQueue = [],
            this
        },
        _addUI: function(t) {
            return this.uiList || (this.uiList = []),
            -1 < this.uiList.indexOf(t) || (this.uiList.push(t),
            this.uiList = this.uiList.sort(function(t, e) {
                return e.options.collisionWeight - t.options.collisionWeight
            })),
            this
        },
        _removeUI: function(t) {
            if (!this.uiList)
                return -1;
            var e = this.uiList.indexOf(t);
            return e < 0 || this.uiList.splice(e, 1),
            e
        }
    });
    var tu = {
        distancetool: {
            start: "\u8d77\u70b9",
            units: {
                mile: " \u82f1\u91cc",
                feet: " \u82f1\u5c3a",
                kilometer: " \u516c\u91cc",
                meter: " \u7c73"
            }
        },
        areatool: {
            units: {
                mile: " \u5e73\u65b9\u82f1\u91cc",
                feet: " \u5e73\u65b9\u82f1\u5c3a",
                kilometer: " \u5e73\u65b9\u516c\u91cc",
                meter: " \u5e73\u65b9\u7c73"
            }
        }
    }
      , eu = {
        distancetool: {
            start: "Inicio",
            units: {
                mile: " mi",
                feet: " ft",
                kilometer: " km",
                meter: " m"
            }
        },
        areatool: {
            units: {
                mile: " mi\xb2",
                feet: " ft\xb2",
                kilometer: " km\xb2",
                meter: " m\xb2"
            }
        }
    }
      , iu = {
        distancetool: {
            start: "Start",
            units: {
                mile: " mi",
                feet: " ft",
                kilometer: " km",
                meter: " m"
            }
        },
        areatool: {
            units: {
                mile: " mi\xb2",
                feet: " ft\xb2",
                kilometer: " km\xb2",
                meter: " m\xb2"
            }
        }
    }
      , nu = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, "Translator: " + t) || this).name = "TranslatorError",
            e
        }
        return it(t, i),
        t
    }(st(Error))
      , ru = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this) || this).languages = {
                "zh-CN": tu,
                "es-MX": eu,
                "en-US": iu
            },
            e.nodes = {},
            e.setLang(t || "zh-CN"),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.setLang = function(t) {
            var e = this.languages[t];
            if (!e)
                throw new nu("Setted Lang does not exist");
            this.nodes = e
        }
        ,
        e._validateNestedProps = function(t) {
            t.forEach(function(t) {
                if ("" === t)
                    throw new nu('Any of sides of a dot "." cannot be empty')
            })
        }
        ,
        e.translate = function(t) {
            if (void 0 === t && (t = null),
            null == t)
                throw new nu("Missing parameter textNode");
            if ("string" != typeof t)
                throw new nu("Param passed has to be a String");
            if (!t.includes("."))
                return this.nodes[t];
            var e = t.split(".");
            if (3 < e.length)
                throw new nu("Translate function can only access through 3 nested properties, trying to access -> " + e.length);
            this._validateNestedProps(e);
            try {
                var i = null;
                switch (e.length) {
                case 2:
                    i = this.nodes[e[0]][e[1]];
                    break;
                case 3:
                    i = this.nodes[e[0]][e[1]][e[2]]
                }
                return i
            } catch (t) {
                throw new nu("Unable to find the text translated in lang json" + t.message)
            }
        }
        ,
        t
    }(qn)
      , ou = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this).on("enable", e._afterEnable, at(at(e))).on("disable", e._afterDisable, at(at(e))),
            e._measureLayers = [],
            e.translator = new ru(e.options.language),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.clear = function() {
            if (St(this._measureLayers))
                for (var t = 0; t < this._measureLayers.length; t++)
                    this._measureLayers[t].remove();
            return delete this._lastMeasure,
            delete this._lastVertex,
            this._outLayers(this._measureLayers),
            this._measureLayers = [],
            this
        }
        ,
        e.getMeasureLayers = function() {
            return this._measureLayers
        }
        ,
        e.getLastMeasure = function() {
            return this._lastMeasure ? this._lastMeasure : 0
        }
        ,
        e.undo = function() {
            i.prototype.undo.call(this);
            var t = this._historyPointer;
            if (t !== this._vertexes.length)
                for (var e = t; e < this._vertexes.length; e++)
                    this._vertexes[e].label && this._vertexes[e].label.remove(),
                    this._vertexes[e].marker.remove();
            return this
        }
        ,
        e.redo = function() {
            i.prototype.redo.call(this);
            var t = this._historyPointer - 1;
            return this._vertexes[t] && (this._vertexes[t].marker.getLayer() || (this._vertexes[t].label && this._vertexes[t].label.addTo(this._measureMarkerLayer),
            this._vertexes[t].marker.addTo(this._measureMarkerLayer))),
            this
        }
        ,
        e._formatLabelContent = function(t) {
            var e = this.options.formatLabelContent;
            return e && H(e) ? e.call(this, t) + "" : null
        }
        ,
        e._measure = function(t) {
            var e, i = this.getMap();
            t instanceof sa ? e = i.computeGeometryLength(t) : Array.isArray(t) && (e = i.getProjection().measureLength(t)),
            this._lastMeasure = e;
            var n = this._formatLabelContent(e);
            if (n)
                return n;
            var r = [this.translator.translate("distancetool.units.meter"), this.translator.translate("distancetool.units.kilometer"), this.translator.translate("distancetool.units.feet"), this.translator.translate("distancetool.units.mile")]
              , o = ""
              , s = this.options.decimalPlaces;
            return this.options.metric && (o += e < 1e3 ? e.toFixed(s) + r[0] : (e / 1e3).toFixed(s) + r[1]),
            this.options.imperial && (e *= 3.2808399,
            0 < o.length && (o += "\n"),
            o += e < 5280 ? e.toFixed(s) + r[2] : (e / 5280).toFixed(s) + r[3]),
            o
        }
        ,
        e._registerMeasureEvents = function() {
            this.on("drawstart", this._msOnDrawStart, this).on("drawvertex", this._msOnDrawVertex, this).on("mousemove", this._msOnMouseMove, this).on("drawend", this._msOnDrawEnd, this)
        }
        ,
        e._afterEnable = function() {
            this._registerMeasureEvents()
        }
        ,
        e._afterDisable = function() {
            this.off("drawstart", this._msOnDrawStart, this).off("drawvertex", this._msOnDrawVertex, this).off("mousemove", this._msOnMouseMove, this).off("drawend", this._msOnDrawEnd, this)
        }
        ,
        e._msOnDrawStart = function(t) {
            var e = this.getMap()
              , i = mt()
              , n = "distancetool_" + i
              , r = "distancetool_markers_" + i
              , o = this.options.zIndex
              , s = this.options.enableAltitude;
            e.getLayer(n) ? (this._measureLineLayer = e.getLayer(n),
            this._measureMarkerLayer = e.getLayer(r)) : (this._measureLineLayer = new sl(n,{
                zIndex: o,
                enableAltitude: s
            }).addTo(e),
            this._measureMarkerLayer = new sl(r,{
                zIndex: o,
                enableAltitude: s
            }).addTo(e)),
            this._measureLayers.push(this._measureLineLayer),
            this._measureLayers.push(this._measureMarkerLayer),
            this._pushLayers([this._measureLineLayer, this._measureMarkerLayer]);
            var a = this._getFirstCoordinate() || t.coordinate
              , h = new Ch(a.copy(),{
                symbol: this.options.vertexSymbol
            })
              , l = this.translator.translate("distancetool.start")
              , u = new Yh(l,a.copy(),this.options.labelOptions);
            this._lastVertex = u,
            this._addVertexMarker(h, u)
        }
        ,
        e._msOnMouseMove = function(t) {
            var e = this._measure(this._msGetCoordsToMeasure(t));
            if (!this._tailMarker) {
                var i = ei(this.options.vertexSymbol);
                i.markerWidth /= 2,
                i.markerHeight /= 2,
                this._tailMarker = new Ch(t.coordinate,{
                    symbol: i
                }).addTo(this._measureMarkerLayer),
                this._tailLabel = new Yh(e,t.coordinate,this.options.labelOptions).addTo(this._measureMarkerLayer)
            }
            var n = this._getLasttCoordinate() || t.coordinate;
            this._tailMarker.setCoordinates(n.copy()),
            this._tailLabel.setContent(e),
            this._tailLabel.setCoordinates(n.copy())
        }
        ,
        e._msGetCoordsToMeasure = function(t) {
            return t.geometry.getCoordinates().concat([t.coordinate])
        }
        ,
        e._msOnDrawVertex = function(t) {
            var e = this._getLasttCoordinate() || t.coordinate
              , i = t.geometry
              , n = new Ch(e.copy(),{
                symbol: this.options.vertexSymbol
            })
              , r = this._measure(i)
              , o = new Yh(r,e.copy(),this.options.labelOptions);
            this._addVertexMarker(n, o),
            this._lastVertex = o
        }
        ,
        e._addVertexMarker = function(t, e) {
            this._vertexes || (this._vertexes = []),
            void 0 !== this._historyPointer && this._vertexes.length > this._historyPointer - 1 && (this._vertexes.length = this._historyPointer - 1),
            this._vertexes.push({
                label: e,
                marker: t
            }),
            this._measureMarkerLayer.addGeometry(t),
            e && this._measureMarkerLayer.addGeometry(e)
        }
        ,
        e._msOnDrawEnd = function(t) {
            if (this._clearTailMarker(),
            t.geometry.getCoordinates().length < 2)
                return this._lastMeasure = 0,
                void this._clearMeasureLayers();
            var e = this._lastVertex.getSize();
            e || (e = new Oe(10,10)),
            this._addClearMarker(this._lastVertex.getCoordinates(), this._lastVertex._getPrjCoordinates(), e.width);
            var i = t.geometry.copy();
            i.setCoordinates(t.geometry.getCoordinates()),
            i.addTo(this._measureLineLayer),
            this._lastMeasure = i.getLength()
        }
        ,
        e._addClearMarker = function(t, e, i) {
            var n = this.options.clearButtonSymbol
              , r = {
                markerDx: (n.markerDx || 0) + i,
                textDx: (n.textDx || 0) + i
            };
            Array.isArray(n) && (r = n.map(function(t) {
                return t ? {
                    markerDx: (t.markerDx || 0) + i,
                    textDx: (t.textDx || 0) + i
                } : null
            })),
            n = ei(n, r);
            var o = new Ch(t,{
                symbol: n
            })
              , s = this._measureLineLayer
              , a = this._measureMarkerLayer;
            o.on("click", function() {
                return s.remove(),
                a.remove(),
                !1
            }, this),
            o.addTo(this._measureMarkerLayer)
        }
        ,
        e._clearTailMarker = function() {
            this._tailMarker && (this._tailMarker.remove(),
            delete this._tailMarker),
            this._tailLabel && (this._tailLabel.remove(),
            delete this._tailLabel)
        }
        ,
        e._clearMeasureLayers = function() {
            this._measureLineLayer.remove(),
            this._measureMarkerLayer.remove()
        }
        ,
        e._getFirstCoordinate = function() {
            return this._geometry ? (this._geometry.getCoordinates() || [])[0] : null
        }
        ,
        e._getLasttCoordinate = function() {
            if (!this._geometry)
                return null;
            var t = this._geometry.getCoordinates() || [];
            return t[t.length - 1]
        }
        ,
        t
    }(cl);
    ou.mergeOptions({
        formatLabelContent: null,
        decimalPlaces: 2,
        mode: "LineString",
        language: "zh-CN",
        metric: !0,
        imperial: !1,
        symbol: {
            lineColor: "#000",
            lineWidth: 3,
            lineOpacity: 1
        },
        vertexSymbol: {
            markerType: "ellipse",
            markerFill: "#fff",
            markerLineColor: "#000",
            markerLineWidth: 3,
            markerWidth: 11,
            markerHeight: 11
        },
        labelOptions: {
            textSymbol: {
                textFaceName: "monospace",
                textLineSpacing: 1,
                textHorizontalAlignment: "right",
                textDx: 15
            },
            boxStyle: {
                padding: [6, 2],
                symbol: {
                    markerType: "square",
                    markerFill: "#fff",
                    markerFillOpacity: .9,
                    markerLineColor: "#b4b3b3"
                }
            }
        },
        clearButtonSymbol: [{
            markerType: "square",
            markerFill: "#fff",
            markerLineColor: "#b4b3b3",
            markerLineWidth: 2,
            markerWidth: 15,
            markerHeight: 15,
            markerDx: 20
        }, {
            markerType: "x",
            markerWidth: 10,
            markerHeight: 10,
            markerDx: 20
        }]
    });
    var su = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this).translator = new ru(e.options.language),
            e._measureLayers = [],
            e
        }
        it(t, i);
        var e = t.prototype;
        return e._measure = function(t) {
            var e, i = this.getMap();
            t instanceof sa ? e = i.computeGeometryArea(t) : Array.isArray(t) && (e = i.getProjection().measureArea(t)),
            this._lastMeasure = e;
            var n = this._formatLabelContent(e);
            if (n)
                return n;
            var r = [this.translator.translate("areatool.units.meter"), this.translator.translate("areatool.units.kilometer"), this.translator.translate("areatool.units.feet"), this.translator.translate("areatool.units.mile")]
              , o = ""
              , s = this.options.decimalPlaces;
            if (this.options.metric && (o += e < 1e6 ? e.toFixed(s) + r[0] : (e / 1e6).toFixed(s) + r[1]),
            this.options.imperial) {
                e *= Math.pow(3.2808399, 2),
                0 < o.length && (o += "\n");
                o += e < 27878400 ? e.toFixed(s) + r[2] : (e / 27878400).toFixed(s) + r[3]
            }
            return o
        }
        ,
        e._msGetCoordsToMeasure = function(t) {
            return t.geometry.getShell().concat([t.coordinate])
        }
        ,
        e._msOnDrawVertex = function(t) {
            var e = this._getLasttCoordinate() || t.coordinate
              , i = new Ch(e.copy(),{
                symbol: this.options.vertexSymbol
            });
            this._measure(t.geometry),
            this._lastVertex = i,
            this._addVertexMarker(i)
        }
        ,
        e._msOnDrawEnd = function(t) {
            var e;
            if (this._clearTailMarker(),
            t.point2d)
                e = this.getMap()._pointToPrj(t.point2d);
            else {
                var i = t.geometry._getPrjCoordinates() || [];
                e = (i = i.slice(0, i.length - 1))[i.length - 1]
            }
            if (t.geometry.getShell().length < 3)
                return this._lastMeasure = 0,
                void this._clearMeasureLayers();
            var n = this._measure(t.geometry)
              , r = this._getLasttCoordinate()
              , o = new Yh(n,r.copy(),this.options.labelOptions).addTo(this._measureMarkerLayer).getSize();
            o || (o = new Oe(10,10)),
            this._addClearMarker(r.copy(), e, o.width);
            var s = t.geometry.copy();
            s.setCoordinates(t.geometry.getCoordinates()),
            s.addTo(this._measureLineLayer),
            this._lastMeasure = s.getArea()
        }
        ,
        t
    }(ou);
    function au(n, t, e) {
        var i, r = Array.isArray(t);
        if (r || (t = [t]),
        !e || !e.target || !e.target._queryTerrainInfo)
            return i = t.map(function(t) {
                return n.unproject(t)
            }),
            r ? i : i[0];
        var o = e.target
          , s = e.enableAltitude;
        return i = t.map(function(t) {
            if (s) {
                var e = o._prjToContainerPoint(t)
                  , i = o._queryTerrainInfo(e);
                if (i && i.coordinate)
                    return i.coordinate
            }
            return n.unproject(t)
        }),
        r ? i : i[0]
    }
    su.mergeOptions({
        mode: "Polygon",
        symbol: {
            lineColor: "#000000",
            lineWidth: 2,
            lineOpacity: 1,
            lineDasharray: "",
            polygonFill: "#ffffff",
            polygonOpacity: .5
        },
        language: "zh-CN"
    });
    var hu = {
        create: function(t, e, i) {
            var n = au(t, e[0], i);
            return new Fh(n,0)
        },
        update: function(t, e, i, n) {
            var r = i.getMap()
              , o = au(t, Array.isArray(e) ? e[e.length - 1] : e, n)
              , s = r.computeLength(i.getCenter(), o);
            i.setRadius(s)
        },
        generate: function(t) {
            return t
        }
    };
    cl.registerMode("circle", F({
        clickLimit: 2,
        action: ["click", "mousemove", "click"]
    }, hu)),
    cl.registerMode("freeHandCircle", F({
        action: ["mousedown touchstart", "mousemove touchmove", "mouseup touchend"]
    }, hu));
    var lu = {
        create: function(t, e, i) {
            var n = au(t, e[0], i);
            return new Gh(n,0,0)
        },
        update: function(t, e, i, n) {
            var r = i.getMap()
              , o = i.getCenter()
              , s = au(t, Array.isArray(e) ? e[e.length - 1] : e, n)
              , a = r.computeLength(o, new Rr({
                x: s.x,
                y: o.y
            }))
              , h = r.computeLength(o, new Rr({
                x: o.x,
                y: s.y
            }));
            i.setWidth(2 * a),
            i.setHeight(2 * h)
        },
        generate: function(t) {
            return t
        }
    };
    cl.registerMode("ellipse", F({
        clickLimit: 2,
        action: ["click", "mousemove", "click"]
    }, lu)),
    cl.registerMode("freeHandEllipse", F({
        action: ["mousedown touchstart", "mousemove touchmove", "mouseup touchend"]
    }, lu));
    var uu = {
        create: function(t, e) {
            var i = new yh([]);
            return i._firstClick = e[0],
            i
        },
        update: function(t, e, i, n) {
            var r = i.getMap()
              , o = n.containerPoint
              , s = r._prjToContainerPoint(i._firstClick)
              , a = au(t, [[s.x, s.y], [o.x, s.y], [o.x, o.y], [s.x, o.y]].map(function(t) {
                return r._containerPointToPrj(new dt(t))
            }), n);
            i.setCoordinates(a)
        },
        generate: function(t) {
            return t
        }
    };
    cl.registerMode("rectangle", F({
        clickLimit: 2,
        action: ["click", "mousemove", "click"]
    }, uu)),
    cl.registerMode("freeHandRectangle", F({
        action: ["mousedown touchstart", "mousemove touchmove", "mouseup touchend"]
    }, uu)),
    cl.registerMode("point", {
        clickLimit: 1,
        action: ["click", "mousemove"],
        create: function(t, e, i) {
            var n = au(t, e[0], i);
            return new Ch(n)
        },
        generate: function(t) {
            return t
        },
        update: function(t, e, i, n) {
            if (Array.isArray(e) && (e = e[e.length - 1]),
            !e)
                return i;
            var r = au(t, e, n);
            return i.setCoordinates(r),
            i
        }
    });
    var cu = {
        create: function(t, e, i) {
            var n = au(t, e, i)
              , r = new Ph(n);
            return r.setCoordinates(n),
            r
        },
        update: function(t, e, i, n) {
            var r, o = i.getSymbol();
            Array.isArray(e) ? r = e : (r = i._drawPrjs || []).push(e);
            var s = au(t, i._drawPrjs = r, n);
            i.setCoordinates(s);
            var a = i.getLayer();
            if (a) {
                var h = a.getGeometryById("polygon");
                if (!h && 3 <= r.length) {
                    if (h = new yh([s],{
                        id: "polygon"
                    }),
                    o) {
                        var l = ei(o, {
                            lineOpacity: 0
                        });
                        h.setSymbol(l)
                    }
                    h.addTo(a)
                }
                h && h.setCoordinates([s])
            }
        },
        generate: function(t) {
            var e = new yh(t.getCoordinates(),{
                symbol: t.getSymbol()
            });
            return e._projCode = t._projCode,
            e
        }
    };
    cl.registerMode("polygon", F({
        action: ["click", "mousemove", "dblclick"]
    }, cu)),
    cl.registerMode("freeHandPolygon", F({
        action: ["mousedown touchstart", "mousemove touchmove", "mouseup touchend"]
    }, cu));
    var du = {
        create: function(t, e, i) {
            var n = au(t, e, i)
              , r = new Ph(n);
            return r.setCoordinates(n),
            r
        },
        update: function(t, e, i, n) {
            var r;
            Array.isArray(e) ? r = e : (r = i._drawPrjs || []).push(e);
            var o = au(t, i._drawPrjs = r, n);
            i.setCoordinates(o)
        },
        generate: function(t) {
            return t
        }
    };
    function fu(t) {
        for (var e = t.tileInfo, i = [e.cols, e.rows], n = [], r = e.lods, o = 0, s = r.length; o < s; o++)
            n.push(r[o].resolution);
        var a = t.fullExtent
          , h = e.origin
          , l = [1, -1, h.x, h.y];
        return delete a.spatialReference,
        {
            spatialReference: {
                resolutions: n,
                fullExtent: a
            },
            tileSystem: l,
            tileSize: i
        }
    }
    function gu(n, t) {
        return void 0 === t && (t = []),
        t.forEach(function(t) {
            var e = t[0]
              , i = t[1];
            n = n.replace(e, i)
        }),
        n
    }
    cl.registerMode("linestring", F({
        action: ["click", "mousemove", "dblclick"]
    }, du)),
    cl.registerMode("freeHandLinestring", F({
        action: ["mousedown touchstart", "mousemove touchmove", "mouseup touchend"]
    }, du)),
    cl.registerMode("arccurve", {
        action: ["click", "mousemove", "dblclick"],
        create: function(e, t) {
            var i = t.map(function(t) {
                return e.unproject(t)
            })
              , n = new Zh(i);
            return n._setPrjCoordinates(t),
            n
        },
        update: du.update,
        generate: function(t) {
            return t
        }
    }),
    cl.registerMode("quadbeziercurve", {
        action: ["click", "mousemove", "dblclick"],
        create: function(e, t) {
            var i = t.map(function(t) {
                return e.unproject(t)
            })
              , n = new Vh(i);
            return n._setPrjCoordinates(t),
            n
        },
        update: du.update,
        generate: function(t) {
            return t
        }
    }),
    cl.registerMode("cubicbeziercurve", {
        action: ["click", "mousemove", "dblclick"],
        create: function(e, t) {
            var i = t.map(function(t) {
                return e.unproject(t)
            })
              , n = new Wh(i);
            return n._setPrjCoordinates(t),
            n
        },
        update: du.update,
        generate: function(t) {
            return t
        }
    }),
    cl.registerMode("boxZoom", {
        action: ["mousedown", "mousemove", "mouseup"],
        create: function(t, e) {
            e = e[0];
            var i = t.unproject(e)
              , n = new Ch(i);
            return n._firstClick = e,
            n
        },
        update: function(t, e, i, n) {
            var r = i.getMap()
              , o = r._prjToContainerPoint(i._firstClick)
              , s = n.containerPoint;
            e = r._containerPointToPrj(new Rr(Math.min(o.x, s.x),Math.min(o.y, s.y)));
            var a = t.unproject(e);
            i.setCoordinates(a)._setPrjCoordinates(e),
            i.updateSymbol({
                markerWidth: Math.abs(o.x - s.x),
                markerHeight: Math.abs(o.y - s.y)
            })
        },
        generate: function(t) {
            return t
        }
    }),
    ia.loadArcgis = function(t, n, e) {
        if (void 0 === e && (e = {
            jsonp: !0
        }),
        P(t) && "{" !== t.substring(0, 1))
            Pn.getJSON(t, function(t, e) {
                if (t)
                    n(t);
                else {
                    var i = fu(e);
                    n(null, i)
                }
            }, e);
        else {
            P(t) && (t = vt(t));
            var i = fu(t);
            n(null, i)
        }
        return this
    }
    ;
    var pu = "wmts";
    function mu(t, e) {
        var i = t.getElementsByTagName(e);
        if (i && i.length)
            return i;
        var n = pu + ":" + e;
        return t.getElementsByTagName(n)
    }
    function _u(t, e) {
        for (var i = 0; i < t.length; i++) {
            var n = t[i];
            if ((n = n.getElementsByTagName("ows:Identifier")[0]) && n.textContent === e)
                return t[i]
        }
        return null
    }
    function vu(t, e) {
        void 0 === e && (e = {});
        var i, n, r, o, s = mu(t, "TileMatrix"), a = [], h = [], l = [], u = !1;
        if (!i) {
            var c = t.getElementsByTagName("ows:SupportedCRS")[0];
            c && (i = function(t) {
                for (var e = "", i = t.split(""), n = i.length - 1; 0 <= n && !isNaN(i[n]); n--)
                    e = i[n] + e;
                return e
            }(i = (i = c.textContent).split("EPSG")[1]),
            i = gu(-1 < (o = i).indexOf("EPSG") ? o : "EPSG:" + o, [["4490", "4326"], ["102100", "3857"], ["900913", "3857"]]))
        }
        n || (n = t.getElementsByTagName("ows:Identifier")[0]) && (n = n.textContent),
        e.projection = i;
        for (var d, f, g, p, m, _, v = 1 / 0, y = 0; y < s.length; y++) {
            var x = s[y]
              , w = x.getElementsByTagName("ows:Identifier")[0].textContent;
            isNaN(parseInt(w)) ? (r = w.substr(0, w.lastIndexOf(":")),
            w = (w = w.split(":"))[w.length - 1],
            w = parseInt(w),
            u = !0,
            e.isGeoServer = !0) : w = parseInt(w),
            v = Math.min(v, w);
            var C = mu(x, "ScaleDenominator")[0].textContent
              , b = mu(x, "TopLeftCorner")[0].textContent
              , P = mu(x, "TileWidth")[0].textContent
              , M = mu(x, "TileHeight")[0].textContent;
            if (0 === l.length && l.push(parseInt(P), parseInt(M)),
            0 === h.length) {
                var T = b.split(" ").filter(function(t) {
                    return "" !== t
                }).map(function(t) {
                    return parseFloat(t)
                })
                  , S = T[0]
                  , E = T[1];
                0 < S ? h.push(1, -1, E, S) : h.push(1, -1, S, E)
            }
            var R = (_ = f = void 0,
            f = (d = e).projection,
            g = d.isArcgis,
            p = d.isGeoServer,
            m = d.isSuperMap,
            _ = .0002645833333333333,
            (g || p || m) && (_ = 28e-5),
            f && -1 < f.indexOf("4326") && (_ = 2.3767925226029154e-9,
            (g || m) && (_ = 2.518101729011901e-9),
            p && (_ = 2.51528279553466e-9)),
            _)
              , A = parseFloat(C) * R;
            a.push(A)
        }
        if (0 < v)
            for (var k = a[0], O = v - 1; 0 <= O; O--)
                k *= 2,
                a.splice(0, 0, k);
        return {
            resolutions: a,
            tileSize: l,
            tileSystem: h,
            projection: i,
            TileMatrixSet: n,
            isGeoServer: u,
            levelStr: r
        }
    }
    ia.loadWMTS = function(n, r, o) {
        return void 0 === o && (o = {
            jsonp: !0
        }),
        P(n) && Pn.get(n, function(t, e) {
            if (t)
                r(t);
            else {
                var i = function(t, e, i) {
                    null == i.isArcgis && (i.isArcgis = -1 < t.indexOf("arcgis")),
                    null == i.isSuperMap && (i.isSuperMap = -1 < t.indexOf("supermap"));
                    var n = (new DOMParser).parseFromString(t, "text/xml").querySelectorAll("Contents")[0];
                    if (!n)
                        return [];
                    var r = mu(n, "Layer");
                    if (!r.length)
                        return [];
                    for (var o = [], s = 0, a = n.childNodes.length; s < a; s++)
                        "TileMatrixSet" === n.childNodes[s].localName && o.push(n.childNodes[s]);
                    if (!o.length)
                        return [];
                    for (var h = [], l = 0, u = r.length; l < u; l++) {
                        var c = r[l]
                          , d = c.querySelectorAll("Style")[0];
                        d && (d = d.getElementsByTagName("ows:Identifier")[0]) && (d = d.textContent);
                        var f = c.getElementsByTagName("ows:Identifier")[0];
                        f && (f = f.textContent);
                        var g = mu(c, "TileMatrixSetLink");
                        if (0 !== g.length)
                            for (var p = 0, m = g.length; p < m; p++) {
                                var _ = g[p];
                                (_ = mu(_, "TileMatrixSet")[0]) && (_ = _.textContent);
                                var v = _u(o, _);
                                if (v) {
                                    var y = c.querySelectorAll("ResourceURL")[0]
                                      , x = "";
                                    y && (x = y.attributes.template.value);
                                    var w = vu(v, i)
                                      , C = w.resolutions
                                      , b = w.tileSize
                                      , P = w.tileSystem
                                      , M = w.projection
                                      , T = w.TileMatrixSet
                                      , S = w.isGeoServer
                                      , E = w.levelStr;
                                    x.length || (x = e.substr(0, e.lastIndexOf("?")),
                                    x += "?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={LAYER}&STYLE={Style}&TILEMATRIXSET={TileMatrixSet}&FORMAT={tiles}&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}");
                                    var R = gu(x, [["{LAYER}", f], ["{Layer}", f], ["{layer}", f], ["{STYLE}", d], ["{Style}", d], ["{style}", d], ["{TileMatrixSet}", T], ["{TileMatrix}", S ? E + ":{z}" : "{z}"], ["{TileRow}", "{y}"], ["{TileCol}", "{x}"], ["{tiles}", S ? "image/png" : "tiles"]]);
                                    h.push({
                                        tileSize: b,
                                        tileSystem: P,
                                        spatialReference: {
                                            resolutions: C,
                                            projection: M
                                        },
                                        urlTemplate: R,
                                        info: {
                                            layerName: f,
                                            TileMatrixSet: T,
                                            style: d,
                                            tileSize: b,
                                            tileSystem: P,
                                            resolutions: C,
                                            projection: M,
                                            urlTemplate: R
                                        }
                                    })
                                }
                            }
                    }
                    return h
                }(e, n, o);
                r(null, i)
            }
        }, o),
        this
    }
    ;
    var yu = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this).proxyOptions(),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.addTo = function(t) {
            return this._owner = t,
            this._switchEvents("on"),
            this.onAdd && this.onAdd(),
            this.fire("add"),
            this
        }
        ,
        e.getMap = function() {
            return this._owner ? this._owner.getBaseLayer ? this._owner : this._owner.getMap() : null
        }
        ,
        e._collides = function() {
            var t = this.getMap();
            return t && (t._addUI(this),
            t._insertUICollidesQueue()),
            this
        }
        ,
        e._collidesEffect = function(t) {
            var e = this.getDOM();
            if (!e)
                return this;
            var i = t ? "visible" : "hidden";
            if (e.style.visibility = i,
            !e.classList || !e.classList.add)
                return this;
            if (!this.options.collisionFadeIn)
                return this;
            var n = "mtk-ui-fadein"
              , r = e.classList.contains(n);
            return t && !r ? e.classList.add(n) : !t && r && e.classList.remove(n),
            this
        }
        ,
        e.show = function(t) {
            var e = this
              , i = this.getMap();
            if (!i)
                return this;
            this.options.visible = !0,
            (t = t || this._coordinate || this._owner.getCenter())instanceof Rr || (t = new Rr(t));
            var n = this.isVisible();
            this._showBySymbolChange || this.fire("showstart");
            var r = this._getUIContainer();
            this._coordinate = t,
            this._removePrevDOM(),
            this._mapEventsOn || this._switchMapEvents("on");
            var o = this.__uiDOM = this.buildOn(i);
            o.eventsPropagation = this.options.eventsPropagation,
            this._observerDomSize(o);
            var s = this.options.zIndex;
            if (!o)
                return this._showBySymbolChange || this.fire("showend"),
                this._collides(),
                this.setZIndex(s),
                this;
            this._measureSize(o),
            this._singleton() && (i[(o._uiComponent = this)._uiDomKey()] = o),
            this._setPosition(),
            o.style[di] = null,
            r.appendChild(o);
            var a = this._getAnimation();
            if (n && (a.ok = !1),
            a.ok && (a.fade && (o.style.opacity = 0),
            a.scale)) {
                if (this.getTransformOrigin) {
                    var h = this.getTransformOrigin();
                    o.style[ci] = h
                }
                o.style[ui] = this._toCSSTranslate(this._pos) + " scale(0)"
            }
            this.isSupportZoomFilter() || (o.style.display = ""),
            this.options.eventsToStop && Ii(o, this.options.eventsToStop, wi);
            var l = a.transition;
            return a.ok && l && (o.offsetHeight,
            l && (o.style[di] = l),
            a.fade && (o.style.opacity = 1),
            a.scale && (o.style[ui] = this._toCSSTranslate(this._pos) + " scale(1)")),
            this._showBySymbolChange || this.fire("showend"),
            this._collides(),
            clearTimeout(this._autoPanId),
            this.options.autoPan && (this._autoPanId = setTimeout(function() {
                e._autoPan()
            }, 32)),
            this.setZIndex(s),
            this
        }
        ,
        e.hide = function() {
            var t = this;
            if (!this.getDOM())
                return this;
            this._onDomMouseout && this._onDomMouseout(),
            this.options.visible = !1;
            var e = this._getAnimation()
              , i = this.getDOM();
            return this.options.animationOnHide || (e.ok = !1),
            e.ok ? (i.offsetHeight,
            i.style[di] = e.transition,
            setTimeout(function() {
                i.style.display = "none",
                t.fire("hide")
            }, this.options.animationDuration)) : (i.style.display = "none",
            this.fire("hide")),
            e.fade && (i.style.opacity = 0),
            e.scale && (i.style[ui] = this._toCSSTranslate(this._pos) + " scale(0)"),
            this._switchMapEvents("off"),
            this._collides(),
            this
        }
        ,
        e.isVisible = function() {
            if (!this.options.visible)
                return !1;
            var t = this.getDOM();
            return this.getMap() && t && t.parentNode && "none" !== t.style.display
        }
        ,
        e.remove = function() {
            if (delete this._mapEventsOn,
            !this._owner)
                return this;
            var t = this.getMap();
            return t && t._removeUI(this),
            this.hide(),
            this._switchEvents("off"),
            this.onRemove && this.onRemove(),
            !this._singleton() && this.__uiDOM && this._removePrevDOM(),
            delete this._owner,
            this.fire("remove"),
            this._collides(),
            this
        }
        ,
        e.getSize = function() {
            return this._domContentRect && this._size && (this._size.width = this._domContentRect.width,
            this._size.height = this._domContentRect.height),
            this._size ? this._size.copy() : null
        }
        ,
        e.getOwner = function() {
            return this._owner
        }
        ,
        e.getDOM = function() {
            return this.__uiDOM
        }
        ,
        e.setZIndex = function(t) {
            if (!G(t))
                return this;
            var e = this.getDOM();
            return e && (e.style.zIndex = t) !== this.options.zIndex && (this.options.zIndex = t),
            this
        }
        ,
        e._roundPoint = function(t) {
            return this.options.roundPoint && (t = t._round()),
            t
        }
        ,
        e.getPosition = function() {
            if (!this.getMap())
                return null;
            var t = this._roundPoint(this._getViewPoint());
            if (this.getOffset) {
                var e = this._roundPoint(this.getOffset());
                e && t._add(e)
            }
            return t
        }
        ,
        e._getAnimation = function() {
            for (var t = {
                fade: !1,
                scale: !1
            }, e = this.options.animation ? this.options.animation.split(",") : [], i = 0; i < e.length; i++) {
                var n = Le(e[i]);
                "fade" === n ? t.fade = !0 : "scale" === n && (t.scale = !0)
            }
            var r = null;
            return t.fade && (r = "opacity " + this.options.animationDuration + "ms"),
            t.scale && (r = r ? r + "," : "",
            r += ui + " " + this.options.animationDuration + "ms"),
            t.transition = r,
            t.ok = null !== r,
            t
        }
        ,
        e._getViewPoint = function() {
            var t = 0
              , e = this._coordinate || {};
            G(e.z) ? t = e.z : this._owner && this._owner.getAltitude && (G(t = this._owner.getAltitude() || 0) || (t = 0));
            var i = this._meterToPoint(this._coordinate, t);
            return this.getMap().coordToViewPoint(this._coordinate, void 0, i)._add(this.options.dx, this.options.dy)
        }
        ,
        e._meterToPoint = function(t, e) {
            return e
        }
        ,
        e._autoPan = function() {
            var t = this.getMap()
              , e = this.getDOM();
            if (e && t && !t.isMoving()) {
                var i = this._getViewPoint()._round()
                  , n = t.width
                  , r = t.height
                  , o = t.getContainer();
                if (e && o && e.getBoundingClientRect) {
                    var s = o.getBoundingClientRect()
                      , a = s.left
                      , h = s.top
                      , l = e.getBoundingClientRect()
                      , u = 0
                      , c = 0
                      , d = l.left
                      , f = l.right
                      , g = l.top
                      , p = l.bottom
                      , m = l.width
                      , _ = l.height;
                    if (d -= a,
                    f -= a,
                    g -= h,
                    p -= h,
                    0 < m && 0 < _) {
                        if (d < 50 && (u = 50 - d),
                        0 === u && n < f + 50 && (u = -(f + 50 - n)),
                        g < 50 && (c = 50 - g),
                        0 === c && r < p + 50 && (c = -(p + 50 - r)),
                        0 !== u || 0 !== c)
                            40 < t.getPitch() && 0 !== c && this._coordinate ? t.animateTo({
                                center: this._coordinate
                            }, {
                                duration: t.options.panAnimationDuration
                            }) : t.panBy([Math.ceil(u), Math.ceil(c)]);
                        return
                    }
                }
                var v = t.viewPointToContainerPoint(i)
                  , y = this.getOffset()
                  , x = v.add(y)
                  , w = t._viewPointToPrj(i)
                  , C = parseInt(e.clientWidth)
                  , b = parseInt(e.clientHeight)
                  , P = 0
                  , M = 0;
                if (x.x < 0 ? P = 50 - x.x : x.x + C > n && (P = -(x.x + C - n) - 50),
                x.y - b < 0 ? M = Math.abs(x.y - b) + 50 : x.y + b > r && (M = r - (x.y + b) - 50),
                n <= C && (P = n / 2 - v.x),
                0 !== M || 0 !== P) {
                    var T = v.add(P, M)
                      , S = t._containerPointToPoint(T)._sub(t._prjToPoint(t._getPrjCenter()))
                      , E = t._pointToPrj(t._prjToPoint(w).sub(S));
                    t._panAnimation(E)
                }
            }
        }
        ,
        e._measureSize = function(t) {
            var e = this._getUIContainer();
            t.style.position = "absolute";
            var i = t.style.bottom ? "bottom" : "top";
            if (t.style.display = "",
            e.appendChild(t),
            t.getBoundingClientRect) {
                var n = t.getBoundingClientRect();
                this._size = new Oe(n.width,n.height)
            } else
                this._size = new Oe(t.clientWidth,t.clientHeight);
            return t.style.display = "none",
            t.style.left = "0px",
            t.style[i] = "0px",
            this._size
        }
        ,
        e._removePrevDOM = function() {
            this.onDomRemove && this.onDomRemove();
            var t = this.options.eventsToStop;
            if (this._singleton()) {
                var e = this.getMap()
                  , i = this._uiDomKey();
                if (e[i]) {
                    t && zi(e[i], t, wi);
                    var n = e[i]._uiComponent;
                    n && n !== this && n.isVisible() && n.fire("hide"),
                    mi(e[i]),
                    n && !this.hideDom && n._switchMapEvents("off"),
                    delete e[i]
                }
                delete this.__uiDOM
            } else
                this.__uiDOM && (t && zi(this.__uiDOM, t, wi),
                mi(this.__uiDOM),
                delete this.__uiDOM);
            this._resizeObserver && (this._resizeObserver.disconnect(),
            delete this._resizeObserver,
            delete this._domContentRect)
        }
        ,
        e._uiDomKey = function() {
            return "__ui_" + this._getClassName()
        }
        ,
        e._singleton = function() {
            return this.options.single
        }
        ,
        e._getUIContainer = function() {
            return this.getMap()._panels.ui
        }
        ,
        e._getClassName = function() {
            return "UIComponent"
        }
        ,
        e._switchMapEvents = function(t) {
            var e = this.getMap();
            if (e) {
                this._mapEventsOn = "on" === t;
                var i = this._getDefaultEvents();
                if (this.getEvents && F(i, this.getEvents()),
                i)
                    for (var n in i)
                        i.hasOwnProperty(n) && e[t](n, i[n], this)
            }
        }
        ,
        e._switchEvents = function(t) {
            var e = this._getOwnerEvents();
            if (this._owner)
                for (var i in e)
                    e.hasOwnProperty(i) && this._owner[t](i, e[i], this)
        }
        ,
        e._getDefaultEvents = function() {
            return {
                "zooming rotate pitch": this.onEvent,
                zoomend: this.onZoomEnd,
                moving: this.onMoving,
                moveend: this.onMoving,
                resize: this.onResize
            }
        }
        ,
        e._getOwnerEvents = function() {
            var t = {};
            return this._owner && this._owner instanceof sa && (t.positionchange = this.onGeometryPositionChange,
            t.symbolchange = this._updatePosition),
            this.getOwnerEvents && F(t, this.getOwnerEvents()),
            t
        }
        ,
        e.onGeometryPositionChange = function(t) {
            this._owner && this.isVisible() && (this._showBySymbolChange = !0,
            this.show(t.target.getCenter()),
            delete this._showBySymbolChange)
        }
        ,
        e.onMoving = function() {
            this.isVisible() && this.getMap().isTransforming() && this._updatePosition()
        }
        ,
        e.onEvent = function() {
            this.isVisible() && this._updatePosition()
        }
        ,
        e.onZoomEnd = function() {
            this.isVisible() && this._setPosition()
        }
        ,
        e.onResize = function() {
            this.isVisible() && this._setPosition()
        }
        ,
        e.onDomSizeChange = function() {
            this.isVisible() && (this._setPosition(),
            this._collides())
        }
        ,
        e._updatePosition = function() {
            return this.getMap() && this.getMap()._getRenderer().callInNextFrame(this._setPosition.bind(this)),
            this
        }
        ,
        e._setPosition = function() {
            var t = this.getDOM();
            if (t) {
                t.style[di] = null;
                var e = this.getPosition();
                this._pos = e,
                t.style[ui] = this._toCSSTranslate(e) + " scale(1)"
            }
        }
        ,
        e._toCSSTranslate = function(t) {
            if (!t)
                return "";
            if ($.any3d) {
                var e = this.getMap()
                  , i = e ? e.getBearing() : 0
                  , n = e ? e.getPitch() : 0
                  , r = "";
                return this.options.pitchWithMap && n && (r += " rotateX(" + Math.round(n) + "deg)"),
                this.options.rotateWithMap && i && (r += " rotateZ(" + Math.round(-i) + "deg)"),
                "translate3d(" + Math.fround(t.x) + "px," + Math.fround(t.y) + "px, 0px)" + r
            }
            return "translate(" + t.x + "px," + t.y + "px)"
        }
        ,
        e._observerDomSize = function(t) {
            var i = this;
            return t && $.resizeObserver && !this._resizeObserver && (this._resizeObserver = new ResizeObserver(function(t) {
                if (t.length) {
                    var e = t[0].borderBoxSize;
                    e && e.length ? i._domContentRect = {
                        width: e[0].inlineSize,
                        height: e[0].blockSize
                    } : i._domContentRect = t[0].contentRect
                } else
                    delete i._domContentRect;
                i.onDomSizeChange && i.onDomSizeChange()
            }
            ),
            this._resizeObserver.observe(t)),
            this
        }
        ,
        e.isSupportZoomFilter = function() {
            return !1
        }
        ,
        e.onConfig = function() {
            return this._updatePosition(),
            this
        }
        ,
        t.isSupport = function(t) {
            return !!(t && H(t.on) && H(t.off) && H(t.getCenter))
        }
        ,
        e._bindDomEvents = function(t, e) {
            if (t) {
                var i = this._getDomEvents() || {}
                  , n = "on" === e ? Ii : zi;
                for (var r in i)
                    n(t, r, i[r], this)
            }
        }
        ,
        e._getDomEvents = function() {
            return {
                mouseover: this._onDomMouseover,
                mouseout: this._onDomMouseout
            }
        }
        ,
        e._configMapPreventWheelScroll = function(t) {
            var e = this.getMap();
            e && (this.options.eventsPropagation || (e.options.preventWheelScroll = t))
        }
        ,
        e._onDomMouseover = function(t) {
            this._configMapPreventWheelScroll(!1)
        }
        ,
        e._onDomMouseout = function(t) {
            this._configMapPreventWheelScroll(!0)
        }
        ,
        t
    }(Un(qn));
    yu.mergeOptions({
        eventsPropagation: !1,
        eventsToStop: null,
        dx: 0,
        dy: 0,
        autoPan: !1,
        autoPanDuration: 600,
        single: !0,
        animation: "scale",
        animationOnHide: !1,
        animationDuration: 500,
        pitchWithMap: !1,
        rotateWithMap: !1,
        visible: !0,
        roundPoint: !1,
        collision: !1,
        collisionBufferSize: 2,
        collisionWeight: 0,
        collisionFadeIn: !1,
        zIndex: 0
    });
    var xu = "mousedown mouseup mouseenter mouseover mouseout mousemove click dblclick contextmenu keypress touchstart touchmove touchend"
      , wu = function(n) {
        function t(t, e) {
            var i;
            return (i = n.call(this, e) || this)._markerCoord = new Rr(t),
            i
        }
        it(t, n);
        var e = t.prototype;
        return e._getClassName = function() {
            return "UIMarker"
        }
        ,
        e.setCoordinates = function(t) {
            return this._markerCoord = t,
            this.fire("positionchange"),
            this.isVisible() && (this._coordinate = this._markerCoord,
            this._setPosition(),
            this._collides()),
            this
        }
        ,
        e.getCoordinates = function() {
            return this._markerCoord
        }
        ,
        e.getCenter = function() {
            return this.getCoordinates()
        }
        ,
        e.getAltitude = function() {
            var t = this.getCoordinates() || {};
            return G(t.z) ? t.z : this.options.altitude || 0
        }
        ,
        e.setAltitude = function(t) {
            return G(t) && this._markerCoord && (this._markerCoord.z = t,
            this._updatePosition && (this._updatePosition(),
            this._collides())),
            this
        }
        ,
        e.setContent = function(t) {
            var e = this.options.content;
            return this.options.content = t,
            this.fire("contentchange", {
                old: e,
                new: t
            }),
            this.isVisible() && this.show(),
            this
        }
        ,
        e.getContent = function() {
            return this.options.content
        }
        ,
        e.onAdd = function() {
            if (this._owner && !this._owner.isMap)
                throw new Error("UIMarker Can only be added to the map, but owner is:",this._owner.getJSONType && this._owner.getJSONType());
            return this.show(),
            this
        }
        ,
        e.show = function() {
            return n.prototype.show.call(this, this._markerCoord)
        }
        ,
        e.flash = function(t, e, i, n) {
            return Ht.call(this, t, e, i, n)
        }
        ,
        e.buildOn = function() {
            var t, e = this.getDOM();
            this._bindDomEvents(e, "off");
            var i = this.options.content
              , n = P(i);
            return n || H(i) ? (t = gi("div"),
            n ? t.innerHTML = this.options.content : i.bind(this)(t)) : t = this.options.content,
            this.options.containerClass && (t.className = this.options.containerClass),
            this._registerDOMEvents(t),
            this._bindDomEvents(t, "on"),
            t
        }
        ,
        e.getOffset = function() {
            var t = this.getSize()
              , e = -t.width / 2
              , i = -t.height / 2
              , n = this.options
              , r = n.horizontalAlignment
              , o = n.verticalAlignment;
            return "left" === r ? e = -t.width : "right" === r && (e = 0),
            "top" === o ? i = -t.height : "bottom" === o && (i = 0),
            new dt(e,i)
        }
        ,
        e.getTransformOrigin = function() {
            return "center center"
        }
        ,
        e.onDomRemove = function() {
            var t = this.getDOM();
            this._removeDOMEvents(t)
        }
        ,
        e.isDragging = function() {
            return !!this.draggable && this.draggable.isDragging()
        }
        ,
        e._registerDOMEvents = function(t) {
            Ii(t, xu, this._onDomEvents, this)
        }
        ,
        e._onDomEvents = function(t) {
            var e = this.getMap()._parseEvent(t, t.type)
              , i = t.type;
            if ("mousedown" === i && (this._mousedownEvent = t),
            "mouseup" === i && (this._mouseupEvent = t),
            ("click" !== i || !this._mouseClickPositionIsChange()) && ("touchstart" === i && (this._touchstartTime = x()),
            this.fire(t.type, e),
            "touchend" === i && $.touch)) {
                var n = this.getMap().options.clickTimeThreshold || 280;
                x() - this._touchstartTime < n && this._onDomEvents(F({}, t, {
                    type: "click"
                }))
            }
        }
        ,
        e._removeDOMEvents = function(t) {
            zi(t, xu, this._onDomEvents, this)
        }
        ,
        e._mouseClickPositionIsChange = function() {
            var t = this._mousedownEvent || {}
              , e = t.x
              , i = t.y
              , n = this._mouseupEvent || {}
              , r = n.x
              , o = n.y;
            return e !== r || i !== o
        }
        ,
        e._getConnectPoints = function() {
            var t = this.getMap()
              , e = t.coordToContainerPoint(this.getCoordinates())
              , i = this.getSize()
              , n = i.width
              , r = i.height;
            return [t.containerPointToCoordinate(e.add(-n / 2, 0)), t.containerPointToCoordinate(e.add(n / 2, 0)), t.containerPointToCoordinate(e.add(0, r / 2)), t.containerPointToCoordinate(e.add(0, -r / 2))]
        }
        ,
        e._getViewPoint = function() {
            var t = 0;
            if (this._owner) {
                var e = this.getAltitude();
                0 < e && (t = this._meterToPoint(this._coordinate, e))
            }
            return this.getMap().coordToViewPoint(this._coordinate, void 0, t)._add(this.options.dx, this.options.dy)
        }
        ,
        e._getDefaultEvents = function() {
            return F({}, n.prototype._getDefaultEvents.call(this), {
                "zooming zoomend": this.onZoomFilter
            })
        }
        ,
        e._setPosition = function() {
            this.onZoomFilter(),
            n.prototype._setPosition.call(this)
        }
        ,
        e.onZoomFilter = function() {
            var t = this.getDOM();
            t && (this.isVisible() || "none" === t.style.display ? this.isVisible() && "none" === t.style.display && (t.style.display = "") : t.style.display = "none")
        }
        ,
        e.isVisible = function() {
            var t = this.getMap();
            if (!t)
                return !1;
            if (!this.options.visible)
                return !1;
            var e = t.getZoom()
              , i = this.options
              , n = i.minZoom
              , r = i.maxZoom;
            return !(!ut(n) && e < n || !ut(r) && r < e) && (this.getDOM() && !0)
        }
        ,
        e.isSupportZoomFilter = function() {
            return !0
        }
        ,
        t
    }(Pr(yu));
    wu.mergeOptions({
        containerClass: null,
        eventsPropagation: !0,
        draggable: !1,
        single: !1,
        content: null,
        altitude: 0,
        minZoom: 0,
        maxZoom: null,
        horizontalAlignment: "middle",
        verticalAlignment: "middle"
    });
    var Cu = $.touch ? "touchstart mousedown" : "mousedown"
      , bu = function(e) {
        function t(t) {
            return e.call(this, t) || this
        }
        it(t, e);
        var i = t.prototype;
        return i.addHooks = function() {
            this.target.on(Cu, this._startDrag, this)
        }
        ,
        i.removeHooks = function() {
            this.target.off(Cu, this._startDrag, this)
        }
        ,
        i._startDrag = function(t) {
            var e = t.domEvent;
            e.touches && 1 < e.touches.length || 2 === e.button || this.isDragging() || (this.target.on("click", this._endDrag, this),
            this._lastCoord = t.coordinate,
            this._lastPoint = t.containerPoint,
            this._prepareDragHandler(),
            this._dragHandler.onMouseDown(t.domEvent),
            this.target.fire("dragstart", t))
        }
        ,
        i._prepareDragHandler = function() {
            this._dragHandler = new Er(this.target.getDOM(),{
                cancelOn: this._cancelOn.bind(this),
                ignoreMouseleave: !0
            }),
            this._dragHandler.on("mousedown", this._onMouseDown, this),
            this._dragHandler.on("dragging", this._dragging, this),
            this._dragHandler.on("mouseup", this._endDrag, this),
            this._dragHandler.enable()
        }
        ,
        i._cancelOn = function(t) {
            var e = (t.srcElement || t.target).tagName.toLowerCase();
            return "button" === e || "input" === e || "select" === e || "option" === e || "textarea" === e
        }
        ,
        i._onMouseDown = function(t) {
            wi(t.domEvent)
        }
        ,
        i._dragging = function(t) {
            var e = this.target
              , i = e.getMap()._parseEvent(t.domEvent)
              , n = i.domEvent;
            if (!(n.touches && 1 < n.touches.length))
                if (this._isDragging) {
                    var r = i.coordinate
                      , o = i.containerPoint;
                    this._lastCoord || (this._lastCoord = r),
                    this._lastPoint || (this._lastPoint = o);
                    var s = r.sub(this._lastCoord)
                      , a = o.sub(this._lastPoint);
                    this._lastCoord = r,
                    this._lastPoint = o,
                    this.target.setCoordinates(this.target.getCoordinates().add(s)),
                    i.coordOffset = s,
                    i.pointOffset = a,
                    e.fire("dragging", i)
                } else
                    this._isDragging = !0
        }
        ,
        i._endDrag = function(t) {
            var e = this.target
              , i = e.getMap();
            if (this._dragHandler && (e.off("click", this._endDrag, this),
            this._dragHandler.disable(),
            delete this._dragHandler),
            delete this._lastCoord,
            delete this._lastPoint,
            this._isDragging = !1,
            i) {
                var n = i._parseEvent(t.domEvent);
                e && e._mouseClickPositionIsChange && e._mouseClickPositionIsChange() && e.fire("dragend", n)
            }
        }
        ,
        i.isDragging = function() {
            return !!this._isDragging
        }
        ,
        t
    }(Jn);
    wu.addInitHook("addHandler", "draggable", bu);
    var Pu = /\{ *([\w_]+) *\}/g
      , Mu = {
        containerClass: "maptalks-msgBox",
        autoPan: !0,
        autoCloseOn: null,
        autoOpenOn: "click",
        width: "auto",
        minHeight: 120,
        custom: !1,
        title: null,
        content: null,
        enableTemplate: !1
    }
      , Tu = new Oe(0,0)
      , Su = function(e) {
        function t() {
            return e.apply(this, arguments) || this
        }
        it(t, e);
        var i = t.prototype;
        return i._getClassName = function() {
            return "InfoWindow"
        }
        ,
        i.addTo = function(t) {
            return t instanceof sa && (t.getInfoWindow() && t.getInfoWindow() !== this && t.removeInfoWindow(),
            t._infoWindow = this),
            e.prototype.addTo.call(this, t)
        }
        ,
        i.setContent = function(t) {
            var e = this.options.content;
            return this.options.content = t,
            this.fire("contentchange", {
                old: e,
                new: t
            }),
            this.isVisible() && this.show(this._coordinate),
            this
        }
        ,
        i.getContent = function() {
            return this.options.content
        }
        ,
        i.setTitle = function(t) {
            var e = t;
            return this.options.title = t,
            this.fire("contentchange", {
                old: e,
                new: t
            }),
            this.isVisible() && this.show(this._coordinate),
            this
        }
        ,
        i.getTitle = function() {
            return this.options.title
        }
        ,
        i.buildOn = function() {
            var t = H(this.options.content)
              , e = P(this.options.content);
            if (this.options.custom) {
                var i, n = this.getDOM();
                if (this._bindDomEvents(n, "off"),
                e || t) {
                    var r = gi("div");
                    e ? (r.innerHTML = this.options.content,
                    this._replaceTemplate(r)) : this.options.content.bind(this)(r),
                    i = r
                } else
                    this._replaceTemplate(this.options.content),
                    i = this.options.content;
                return this._bindDomEvents(i, "on"),
                i
            }
            this._bindDomEvents(this.getDOM(), "off");
            var o = gi("div");
            this.options.containerClass && (o.className = this.options.containerClass);
            var s = this._getWindowWidth();
            o.style.width = G(s) ? s + "px" : "auto",
            o.style.bottom = "0px";
            var a = '<em class="maptalks-ico"></em>';
            this.options.title && (a += "<h2>" + this.options.title + "</h2>"),
            a += '<a href="javascript:void(0);" class="maptalks-close">\xd7</a><div class="maptalks-msgContent"></div>',
            o.innerHTML = a,
            this._replaceTemplate(o);
            var h = o.querySelector(".maptalks-msgContent");
            return e || t ? e ? h.innerHTML = this.options.content : this.options.content.bind(this)(h) : h.appendChild(this.options.content),
            this._onCloseBtnClick = this.hide.bind(this),
            _i(o.querySelector(".maptalks-close"), "click touchend", this._onCloseBtnClick),
            t || this._replaceTemplate(h),
            this._bindDomEvents(o, "on"),
            o
        }
        ,
        i._replaceTemplate = function(t) {
            if (this.options.enableTemplate && this._owner && this._owner.getProperties && t && t.innerHTML) {
                var i = this._owner.getProperties() || {};
                if (_(i)) {
                    var e = t.innerHTML;
                    t.innerHTML = e.replace(Pu, function(t, e) {
                        return i[e]
                    })
                }
            }
            return this
        }
        ,
        i.getTransformOrigin = function() {
            return this.getSize().width / 2 + "px bottom"
        }
        ,
        i.getOffset = function() {
            var t = this.getSize()
              , e = new dt(-t.width / 2,0);
            this.options.custom ? e._sub(0, t.height) : e._sub(4, 12);
            var i = this.getOwner();
            if (i instanceof Ch || i instanceof Rh) {
                var n, r;
                if (i instanceof Ch)
                    n = i._getPainter(),
                    r = i.getSize();
                else {
                    var o = i.getGeometries();
                    if (!o || !o.length)
                        return e;
                    n = o[0]._getPainter(),
                    r = o[0].getSize()
                }
                if (r || (r = Tu),
                n) {
                    var s = n.getFixedExtent();
                    e._add(s.xmax - r.width / 2, s.ymin)
                } else
                    e._add(0, -r.height)
            }
            return e
        }
        ,
        i.show = function(t) {
            return this.getMap() && this.getMap().options.enableInfoWindow ? e.prototype.show.call(this, t) : this
        }
        ,
        i.getEvents = function() {
            if (!this.options.autoCloseOn)
                return null;
            var t = {};
            return t[this.options.autoCloseOn] = this.hide,
            t
        }
        ,
        i.getOwnerEvents = function() {
            var t = this.getOwner();
            if (!this.options.autoOpenOn || !t)
                return null;
            var e = {};
            return e[this.options.autoOpenOn] = this._onAutoOpen,
            e
        }
        ,
        i.onRemove = function() {
            this._onDomMouseout(),
            this.onDomRemove()
        }
        ,
        i.onDomRemove = function() {
            this._onCloseBtnClick && (vi(this.getDOM().childNodes[2], "click touchend", this._onCloseBtnClick),
            delete this._onCloseBtnClick)
        }
        ,
        i._onAutoOpen = function(t) {
            var e = this
              , i = this.getOwner();
            setTimeout(function() {
                i instanceof Ch || i instanceof yu ? e.show(i.getCoordinates()) : i instanceof Rh ? e.show(i.findClosest(t.coordinate)) : ((i instanceof Ph || i instanceof kh) && 8 <= e.getMap().getScale() && (t.coordinate = e._rectifyMouseCoordinte(i, t.coordinate)),
                e.show(t.coordinate))
            }, 1)
        }
        ,
        i._rectifyMouseCoordinte = function(t, e) {
            var i = this;
            return t instanceof Ph ? this._rectifyLineStringMouseCoordinate(t, e).coordinate : t instanceof kh ? t.getGeometries().map(function(t) {
                return i._rectifyLineStringMouseCoordinate(t, e)
            }).sort(function(t, e) {
                return t.dis - e.dis
            })[0].coordinate : e
        }
        ,
        i._rectifyLineStringMouseCoordinate = function(t, e) {
            for (var n = this.getMap(), i = t.getCoordinates() || [], r = n.getGLRes(), o = i.map(function(t) {
                var e = n.coordToPointAtRes(t, r)
                  , i = t.z || 0;
                return n._pointAtResToContainerPoint(e, r, i)
            }), s = n.coordToContainerPoint(e), a = 1 / 0, h = -1, l = 0, u = o.length; l < u; l++) {
                var c = o[l]
                  , d = s.distanceTo(c);
                d < a && (a = d,
                h = l)
            }
            for (var f = [h - 1, h, h + 1].filter(function(t) {
                return 0 <= t && t <= o.length - 1
            }), g = f.map(function(t) {
                return o[t]
            }), p = [], m = n.getSize(), _ = m.width, v = m.height, y = 0, x = g.length - 1; y < x; y++) {
                var w = y
                  , C = g[y]
                  , b = g[y + 1];
                if (C.x === b.x)
                    for (var P = Math.max(0, Math.min(C.y, b.y)), M = Math.min(v, Math.max(C.y, b.y)), T = P; T <= M; T++)
                        p.push({
                            point: new dt(C.x,T),
                            coordinateIndex: w
                        });
                else
                    for (var S = (b.y - C.y) / (b.x - C.x), E = Math.max(0, Math.min(C.x, b.x)), R = Math.min(_, Math.max(C.x, b.x)), A = E; A <= R; A++) {
                        var k = S * (A - C.x) + C.y;
                        p.push({
                            point: new dt(A,k),
                            coordinateIndex: w
                        })
                    }
            }
            for (var O, L = 1 / 0, D = -1, I = -1, z = 0, j = p.length; z < j; z++) {
                var F = p[z]
                  , G = F.point
                  , H = F.coordinateIndex
                  , B = s.distanceTo(G);
                B < L && (L = B,
                D = z,
                I = H,
                O = G)
            }
            if (D < 0)
                return {
                    dis: L,
                    coordinate: e
                };
            var N = g[I]
              , Z = g[I + 1]
              , W = N.distanceTo(Z)
              , V = O.distanceTo(N) / W
              , U = f.map(function(t) {
                return i[t]
            })
              , J = U[I]
              , q = U[I + 1]
              , X = J.x
              , Y = J.y
              , Q = J.z || 0
              , K = q.x
              , $ = q.y
              , tt = q.z || 0;
            return {
                dis: L,
                coordinate: new Rr(X + (K - X) * V,Y + ($ - Y) * V,Q + (tt - Q) * V)
            }
        }
        ,
        i._getWindowWidth = function() {
            var t = Mu.width
              , e = this.options.width;
            return e || (e = t),
            e
        }
        ,
        t
    }(yu);
    Su.mergeOptions(Mu);
    var Eu = "remove hide shapechange positionchange dragend animatestart"
      , Ru = function(n) {
        it(e, n);
        var t = e.prototype;
        function e(t, e) {
            var i;
            return void 0 === e && (e = {}),
            (i = n.call(this, e) || this)._content = t,
            i
        }
        return t._getClassName = function() {
            return "ToolTip"
        }
        ,
        t.addTo = function(t) {
            if (e.isSupport(t))
                return t.on("mousemove", this.onMouseMove, this),
                t.on("mouseout", this.onMouseOut, this),
                t.on(Eu, this.hideDom, this),
                n.prototype.addTo.call(this, t);
            throw new Error("Invalid geometry or UIMarker the tooltip is added to.")
        }
        ,
        t.setStyle = function(t) {
            return this.options.containerClass = t,
            this
        }
        ,
        t.getStyle = function() {
            return this.options.containerClass
        }
        ,
        t.getContent = function() {
            return this._content
        }
        ,
        t.buildOn = function() {
            var t = gi("div")
              , e = this.options || {};
            e.height && (t.style.height = e.height + "px"),
            e.width && (t.style.width = e.width + "px");
            var i = e.containerClass || e.cssName;
            return !i && e.height && (t.style.lineHeight = e.height + "px"),
            H(this._content) ? this._content.bind(this)(t) : t.innerHTML = '<div class="' + i + '">' + this._content + "</div>",
            t
        }
        ,
        t.onMouseOut = function() {
            clearTimeout(this._timeout),
            this.isVisible() && this._removePrevDOM(),
            this._switchMapEvents("off")
        }
        ,
        t.onMouseMove = function(t) {
            var e = this;
            clearTimeout(this._timeout);
            var i = this.getMap();
            if (i) {
                var n = i.locateByPoint(t.coordinate, -5, 25);
                0 === this.options.showTimeout ? this.show(n) : this._timeout = setTimeout(function() {
                    i && e.show(n)
                }, this.options.showTimeout)
            }
        }
        ,
        t.onRemove = function() {
            clearTimeout(this._timeout),
            this._owner && (this._owner.off("mouseover", this.onMouseOver, this),
            this._owner.off("mouseout", this.onMouseOut, this),
            this._owner.off(Eu, this.hideDom, this))
        }
        ,
        t.hideDom = function() {
            return this.hide()
        }
        ,
        t.onEvent = function() {
            return n.prototype.onEvent.call(this),
            this.hideDom(),
            this
        }
        ,
        t._getViewPoint = function() {
            return this.getMap().coordToViewPoint(this._coordinate, void 0, 0)._add(this.options.dx, this.options.dy)
        }
        ,
        e
    }(yu);
    Ru.mergeOptions({
        width: 0,
        height: 0,
        animation: "fade",
        containerClass: "maptalks-tooltip",
        showTimeout: 400
    });
    var Au = function(e) {
        function t(t) {
            return e.call(this, t) || this
        }
        it(t, e);
        var i = t.prototype;
        return i._getClassName = function() {
            return "Menu"
        }
        ,
        i.addTo = function(t) {
            return t._menu && t._menu !== this && t.removeMenu(),
            (t._menu = this)._owner = t,
            yu.prototype.addTo.apply(this, arguments)
        }
        ,
        i.setItems = function(t) {
            return this.options.items = t,
            this
        }
        ,
        i.getItems = function() {
            return this.options.items || []
        }
        ,
        i.buildOn = function() {
            if (this.options.custom) {
                if (P(this.options.items)) {
                    var t = gi("div");
                    return t.innerHTML = this.options.items,
                    t
                }
                return this.options.items
            }
            var e = gi("div");
            this.options.containerClass && Ei(e, this.options.containerClass),
            e.style.width = this._getMenuWidth() + "px";
            var i = this._createMenuItemDom();
            return e.appendChild(i),
            Ii(e, "contextmenu", xi),
            e
        }
        ,
        i.getOffset = function() {
            if (!this.getMap())
                return null;
            var t = this.getMap().getSize()
              , e = this.getMap().viewPointToContainerPoint(this._getViewPoint())
              , i = this.getSize()
              , n = 0
              , r = 0;
            return e.x + i.width > t.width && (n = -i.width),
            e.y + i.height > t.height && (r = -i.height),
            new dt(n,r)
        }
        ,
        i.getTransformOrigin = function() {
            var t = this.getOffset()._multi(-1);
            return t.x + "px " + t.y + "px"
        }
        ,
        i.getEvents = function() {
            return {
                "_zoomstart _zoomend _movestart _dblclick _click": this._removePrevDOM
            }
        }
        ,
        i._createMenuItemDom = function() {
            var n = this
              , r = this.getMap()
              , t = gi("ul");
            Ei(t, "maptalks-menu-items");
            var e, i, o = this.getItems();
            function s(i) {
                return function(t) {
                    var e = r._parseEvent(t, "click");
                    e.target = n,
                    e.owner = n._owner,
                    e.index = i,
                    !1 !== this._callback(e) && (n.hide(),
                    n._owner && n._owner.fire("closemenu"))
                }
            }
            for (var a = 0, h = o.length; a < h; a++) {
                if ("-" === (e = o[a]) || "_" === e)
                    Ei(i = gi("li"), "maptalks-menu-splitter");
                else {
                    i = gi("li");
                    var l = e.item;
                    H(l) && (l = l({
                        owner: this._owner,
                        index: a
                    })),
                    i.innerHTML = l,
                    i._callback = e.click,
                    Ii(i, "click", s(a))
                }
                t.appendChild(i)
            }
            var u = this.options.maxHeight || 0;
            return 0 < u && Ti(t, "max-height: " + u + "px; overflow-y: auto;"),
            t
        }
        ,
        i._getMenuWidth = function() {
            return this.options.width || 160
        }
        ,
        t
    }(yu);
    Au.mergeOptions({
        containerClass: "maptalks-menu",
        animation: null,
        animationDelay: 10,
        animationOnHide: !1,
        autoPan: !1,
        width: 160,
        maxHeight: 0,
        custom: !1,
        items: []
    });
    var ku = {
        setMenu: function(t) {
            return this._menuOptions = t,
            this._menu ? this._menu.setOptions(t) : this.on("contextmenu", this._defaultOpenMenu, this),
            this
        },
        getMenu: function() {
            return this._menu
        },
        openMenu: function(t) {
            var e = this instanceof Qa ? this : this.getMap();
            return t || (t = this.getCenter()),
            this._menu ? this._menu.show(t) : this._menuOptions && e && (this._bindMenu(),
            this._menu.show(t)),
            this.fire("openmenu", {
                coordinate: t
            }),
            this
        },
        setMenuItems: function(t) {
            return this._menuOptions || (this._menuOptions = {}),
            Array.isArray(t) && (this._menuOptions.custom = !1),
            this._menuOptions.items = t,
            this.setMenu(this._menuOptions),
            this
        },
        getMenuItems: function() {
            return this._menu ? this._menu.getItems() : this._menuOptions && this._menuOptions.items || []
        },
        closeMenu: function() {
            return this._menu && this._menu.hide(),
            this.fire("closemenu", {}),
            this
        },
        removeMenu: function() {
            return this.off("contextmenu", this._defaultOpenMenu, this),
            this._unbindMenu(),
            delete this._menuOptions,
            this.fire("removemenu", {}),
            this
        },
        _bindMenu: function() {
            return this._menuOptions && (this._menu = new Au(this._menuOptions),
            this._menu.addTo(this)),
            this
        },
        _unbindMenu: function() {
            return this._menu && (this.closeMenu(),
            this._menu.remove(),
            delete this._menu),
            this
        },
        _defaultOpenMenu: function(t) {
            return this.openMenu(t.coordinate),
            !1
        }
    };
    Qa.include(ku),
    sa.include(ku);
    var Ou = Object.freeze({
        UIComponent: yu,
        UIMarker: wu,
        InfoWindow: Su,
        ToolTip: Ru,
        Menuable: ku,
        Menu: Au
    })
      , Lu = function(e) {
        function i(t) {
            return t && t.position && !P(t.position) && (t.position = F({}, t.position)),
            e.call(this, t) || this
        }
        it(i, e);
        var t = i.prototype;
        return t.addTo = function(t) {
            if (this.remove(),
            !t.options.control)
                return this;
            var e = (this._map = t)._panels.control;
            return this.__ctrlContainer = gi("div"),
            Ti(this.__ctrlContainer, "position:absolute;overflow:visible;"),
            this.update(),
            e.appendChild(this.__ctrlContainer),
            this.onAdd && this.onAdd(),
            this.fire("add", {
                dom: e
            }),
            this
        }
        ,
        t.update = function() {
            return this.__ctrlContainer.innerHTML = "",
            this._controlDom = this.buildOn(this.getMap()),
            this._controlDom && (this._updatePosition(),
            this.__ctrlContainer.appendChild(this._controlDom)),
            this
        }
        ,
        t.getMap = function() {
            return this._map
        }
        ,
        t.getPosition = function() {
            return F({}, this._parse(this.options.position))
        }
        ,
        t.setPosition = function(t) {
            return P(t) ? this.options.position = t : this.options.position = F({}, t),
            this._updatePosition(),
            this
        }
        ,
        t.getContainerPoint = function() {
            var t, e, i = this.getPosition(), n = this.getMap().getSize();
            return ut(i.left) ? ut(i.right) || (t = n.width - parseInt(i.right)) : t = parseInt(i.left),
            ut(i.top) ? ut(i.bottom) || (e = n.height - parseInt(i.bottom)) : e = parseInt(i.top),
            new dt(t,e)
        }
        ,
        t.getContainer = function() {
            return this.__ctrlContainer
        }
        ,
        t.getDOM = function() {
            return this._controlDom
        }
        ,
        t.show = function() {
            return this.__ctrlContainer.style.display = "",
            this
        }
        ,
        t.hide = function() {
            return this.__ctrlContainer.style.display = "none",
            this
        }
        ,
        t.isVisible = function() {
            return this.__ctrlContainer && "" === this.__ctrlContainer.style.display
        }
        ,
        t.remove = function() {
            return this._map && (mi(this.__ctrlContainer),
            this.onRemove && this.onRemove(),
            delete this._map,
            delete this.__ctrlContainer,
            delete this._controlDom,
            this.fire("remove")),
            this
        }
        ,
        t._parse = function(t) {
            var e = t;
            return P(t) && (e = i.positions[e]),
            e
        }
        ,
        t._updatePosition = function() {
            var t = this.getPosition();
            for (var e in t || (t = {
                top: 20,
                left: 20
            }),
            t)
                if (t.hasOwnProperty(e)) {
                    var i = t[e] || 0;
                    G(i) && (i += "px"),
                    this.__ctrlContainer.style[e] = i
                }
            this.fire("positionchange", {
                position: F({}, t)
            })
        }
        ,
        i
    }(Un(qn));
    Lu.positions = {
        "top-left": {
            top: 20,
            left: 20
        },
        "top-right": {
            top: 20,
            right: 20
        },
        "bottom-left": {
            bottom: 20,
            left: 20
        },
        "bottom-right": {
            bottom: 20,
            right: 20
        }
    },
    Qa.mergeOptions({
        control: !0
    }),
    Qa.include({
        addControl: function(t) {
            return this._containerDOM.getContext || t.addTo(this),
            this
        },
        removeControl: function(t) {
            return t && t.getMap() === this && t.remove(),
            this
        }
    });
    var Du = "addlayer removelayer setbaselayer baselayerremove"
      , Iu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function() {
            return this._attributionContainer = gi("div"),
            this._attributionContainer.className = "maptalks-attribution",
            this._update(),
            this._attributionContainer
        }
        ,
        i.onAdd = function() {
            this.getMap().on(Du, this._update, this)
        }
        ,
        i.onRemove = function() {
            this.getMap().off(Du, this._update, this)
        }
        ,
        i._update = function() {
            var t = this.getMap();
            if (t) {
                var e = t._getLayers(function(t) {
                    return t.options.attribution
                }).reverse().map(function(t) {
                    return t.options.attribution
                })
                  , i = this.options.content + (0 < e.length ? " - " + e.join(", ") : "");
                this._attributionContainer.innerHTML = '<span style="padding:0px 4px">' + i + "</span>"
            }
        }
        ,
        e
    }(Lu);
    Iu.mergeOptions({
        position: {
            bottom: 0,
            left: 0
        },
        content: '<a href="http://maptalks.org" target="_blank">maptalks</a>'
    }),
    Qa.mergeOptions({
        attribution: !0
    }),
    Qa.addOnLoadHook(function() {
        var t = this.options.attribution || this.options.attributionControl;
        t && (this.attributionControl = new Iu(t),
        this.addControl(this.attributionControl))
    });
    var zu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function(t) {
            var e = this._getCompass();
            return this._compass = e,
            this._registerDomEvents(),
            t.on("resize moving moveend zooming zoomend rotate rotateend dragrotating dragrotateend viewchange", this._rotateCompass, this),
            e
        }
        ,
        i.onAdd = function() {
            this._rotateCompass()
        }
        ,
        i._getCompass = function() {
            return gi("div", "maptalks-compass")
        }
        ,
        i._registerDomEvents = function() {
            Ii(this._compass, "click", this._resetView, this)
        }
        ,
        i._rotateCompass = function() {
            var t = this.getMap().getBearing().toFixed(1);
            t <= 180 && (t *= -1),
            t !== this._bearing && (this._bearing = t,
            Ti(this._compass, "transform: rotate(" + this._bearing + "deg);"))
        }
        ,
        i.onRemove = function() {
            this.getMap().off("resize moving moveend zooming zoomend rotate rotateend dragrotating dragrotateend viewchange", this._rotateCompass, this),
            delete this._compass,
            delete this._bearing
        }
        ,
        i._resetView = function() {
            this.getMap().animateTo({
                bearing: 0
            })
        }
        ,
        e
    }(Lu);
    zu.mergeOptions({
        position: {
            top: 120,
            left: 20
        }
    }),
    Qa.mergeOptions({
        compassControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.compassControl && (this.compassControl = new zu(this.options.compassControl),
        this.addControl(this.compassControl))
    });
    var ju = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function() {
            var t = this.container = gi("div", this.options.containerClass)
              , e = this.panel = gi("div", "panel")
              , i = this.button = gi("button");
            return t.appendChild(i),
            t.appendChild(e),
            t
        }
        ,
        i.onAdd = function() {
            Ii(this.button, "mouseover", this._show, this),
            Ii(this.panel, "mouseleave", this._hide, this),
            Ii(this.getMap(), "click", this._hide, this)
        }
        ,
        i.onRemove = function() {
            this.panel && (zi(this.button, "mouseover", this._show, this),
            zi(this.panel, "mouseleave", this._hide, this),
            zi(this.getMap(), "click", this._hide, this),
            mi(this.panel),
            mi(this.button),
            delete this.panel,
            delete this.button,
            delete this.container)
        }
        ,
        i._show = function() {
            Si(this.container, "shown") || (Ei(this.container, "shown"),
            this._createPanel())
        }
        ,
        i._hide = function(t) {
            this.panel.contains(t.toElement || t.relatedTarget) || Ri(this.container, this.options.containerClass)
        }
        ,
        i._createPanel = function() {
            this.panel.innerHTML = "";
            var t = gi("ul");
            this.panel.appendChild(t),
            this._renderLayers(this.getMap(), t)
        }
        ,
        i._renderLayers = function(t, e) {
            var r = this
              , i = t.getBaseLayer()
              , n = t.getLayers()
              , o = n.length;
            if (i) {
                var s = i.layers || [i]
                  , a = gi("li", "group")
                  , h = gi("ul")
                  , l = gi("label");
                l.innerHTML = this.options.baseTitle,
                a.appendChild(l);
                for (var u = 0, c = s.length; u < c; u++) {
                    var d = s[u];
                    this._isExcluded(d) && (h.appendChild(this._renderLayer(s[u], !0)),
                    a.appendChild(h),
                    e.appendChild(a))
                }
            }
            if (o) {
                var f = gi("li", "group")
                  , g = gi("ul")
                  , p = gi("label")
                  , m = gi("input");
                m.type = "checkbox",
                m.checked = !0,
                p.innerHTML = this.options.overlayTitle,
                f.appendChild(m),
                f.appendChild(p);
                for (var _ = function(t) {
                    var n = t.target.checked
                      , e = t.target.parentNode;
                    if (e) {
                        var i = e.getElementsByTagName("ul")[0];
                        if (i) {
                            var r = function(t) {
                                var e = t._layer;
                                e && e[n ? "show" : "hide"]()
                            }
                              , o = function(t) {
                                var e = t._layer
                                  , i = t.childNodes[0];
                                i && (i.checked = n),
                                e && e[n ? "show" : "hide"]()
                            };
                            r(e),
                            i.childNodes.forEach(function(t) {
                                o(t);
                                var e = t.getElementsByTagName("ul")[0];
                                e && (r(t),
                                e.childNodes.forEach(function(t) {
                                    o(t)
                                }))
                            })
                        }
                    }
                }, v = 0; v < o; v++) {
                    var y = n[v];
                    this._isExcluded(y) && (y.getLayers ? function() {
                        var t = gi("li", "group")
                          , e = gi("ul")
                          , i = gi("label")
                          , n = gi("input");
                        i.innerHTML = y.getId(),
                        n.type = "checkbox",
                        n.checked = y.isVisible(),
                        n.onchange = _,
                        t.appendChild(n),
                        t.appendChild(i),
                        t.appendChild(e),
                        t._layer = y,
                        g.appendChild(t),
                        (y.getLayers() || []).forEach(function(t) {
                            e.appendChild(r._renderLayer(t, !1, n.checked))
                        })
                    }() : g.appendChild(this._renderLayer(y)),
                    y && !y.isVisible() && (m.checked = !1))
                }
                f.appendChild(g),
                e.appendChild(f),
                m.onchange = _
            }
        }
        ,
        i._isExcluded = function(t) {
            var e = t.getId()
              , i = this.options.excludeLayers;
            return !(i.length && 0 <= i.indexOf(e))
        }
        ,
        i._renderLayer = function(s, t, e) {
            var a = this;
            void 0 === e && (e = !0);
            var i = gi("li", "layer")
              , n = gi("label")
              , r = gi("input")
              , h = this.getMap()
              , o = s.options.visible;
            s.options.visible = !0;
            var l = s.isVisible();
            return s.options.visible = o,
            i.className = "layer",
            t ? (r.type = "radio",
            r.name = "base") : r.type = "checkbox",
            r.checked = o && l,
            e || (r.checked = !1),
            l || r.setAttribute("disabled", "disabled"),
            r.onchange = function(t) {
                if ("radio" === t.target.type) {
                    var e = h.getBaseLayer()
                      , i = e.layers;
                    if (i)
                        for (var n = 0, r = i.length; n < r; n++) {
                            var o = i[n];
                            o[o === s ? "show" : "hide"]()
                        }
                    else
                        e.isVisible() || e.show();
                    h._fireEvent("setbaselayer")
                } else
                    s[t.target.checked ? "show" : "hide"]();
                a.fire("layerchange", {
                    target: s
                })
            }
            ,
            i.appendChild(r),
            n.innerHTML = s.getId(),
            i.appendChild(n),
            i._layer = s,
            i
        }
        ,
        e
    }(Lu);
    ju.mergeOptions({
        position: "top-right",
        baseTitle: "Base Layers",
        overlayTitle: "Layers",
        excludeLayers: [],
        containerClass: "maptalks-layer-switcher"
    }),
    Qa.mergeOptions({
        layerSwitcherControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.layerSwitcherControl && (this.layerSwitcherControl = new ju(this.options.layerSwitcherControl),
        this.addControl(this.layerSwitcherControl))
    });
    var Fu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function() {
            var t = this.options.size;
            this.options.maximize || (t = [0, 0]);
            var e = gi("div")
              , i = this.mapContainer = gi("div");
            i.style.width = t[0] + "px",
            i.style.height = t[1] + "px",
            i.className = this.options.containerClass;
            var n = this.button = gi("div");
            return n.className = this.options.buttonClass,
            e.appendChild(i),
            e.appendChild(n),
            e
        }
        ,
        i.onAdd = function() {
            this.options.maximize && this._createOverview(),
            this.getMap().on("resize moving zooming rotate dragrotating viewchange", this._update, this).on("setbaselayer", this._updateBaseLayer, this).on("spatialreferencechange", this._updateSpatialReference, this),
            Ii(this.button, "click", this._onButtonClick, this),
            this._updateButtonText()
        }
        ,
        i.onRemove = function() {
            this.getMap().off("resize moving zooming rotate dragrotating viewchange", this._update, this).off("setbaselayer", this._updateBaseLayer, this).off("spatialreferencechange", this._updateSpatialReference, this),
            this._overview && (this._overview.remove(),
            delete this._overview,
            delete this._perspective),
            zi(this.button, "click", this._onButtonClick, this)
        }
        ,
        i.maxmize = function() {
            var t = this.options.size
              , e = this.mapContainer;
            return e.style.width = t[0] + "px",
            e.style.height = t[1] + "px",
            this._createOverview(),
            this
        }
        ,
        i.minimize = function() {
            this._overview && this._overview.remove(),
            delete this._overview,
            delete this._perspective;
            var t = this.mapContainer;
            return t.style.width = "0px",
            t.style.height = "0px",
            this
        }
        ,
        i.getOverviewMap = function() {
            return this._overview
        }
        ,
        i._onButtonClick = function() {
            this._overview ? this.minimize() : this.maxmize(),
            this._updateButtonText()
        }
        ,
        i._updateButtonText = function() {
            this._overview ? this.button.innerHTML = "-" : this.button.innerHTML = "+"
        }
        ,
        i._createOverview = function() {
            var t = this.getMap()
              , e = this.mapContainer
              , i = t.config();
            F(i, {
                center: t.getCenter(),
                zoom: this._getOverviewZoom(),
                zoomAnimationDuration: 150,
                pitch: 0,
                bearing: 0,
                scrollWheelZoom: !1,
                checkSize: !1,
                doubleClickZoom: !1,
                touchZoom: !1,
                control: !1,
                draggable: !1,
                maxExtent: null
            }),
            this._overview = new Qa(e,i),
            this._updateBaseLayer(),
            this._perspective = new yh(this._getPerspectiveCoords(),{
                draggable: !0,
                cursor: "move",
                symbol: this.options.symbol
            }).on("dragend", this._onDragEnd, this),
            new sl("perspective_layer",this._perspective).addTo(this._overview),
            this.fire("load")
        }
        ,
        i._getOverviewZoom = function() {
            var t = this.getMap()
              , e = t.getZoom()
              , i = t.getMinZoom()
              , n = this.options.level;
            if (0 < n) {
                for (var r = n; 0 < r; r--)
                    if (i <= e - r)
                        return e - r
            } else
                for (var o = n; o < 0; o++)
                    if (i <= e - o)
                        return e - o;
            return e
        }
        ,
        i._onDragEnd = function() {
            var t = this._perspective.getCenter();
            this._overview.setCenter(t),
            this.getMap().panTo(t)
        }
        ,
        i._getPerspectiveCoords = function() {
            var i = this.getMap()
              , n = i.getProjection();
            return i.getContainerExtent().toArray().map(function(t) {
                if (n) {
                    var e = i._containerPointToPrj(t);
                    return i._fixPrjOnWorldWide(e),
                    n.unproject(e)
                }
                return i.containerPointToCoordinate(t)
            })
        }
        ,
        i._update = function() {
            if (this._overview) {
                Pi(this._overview._containerDOM);
                var t = this._getPerspectiveCoords();
                this._perspective.setCoordinates(t),
                this._overview.setCenterAndZoom(this.getMap().getCenter(), this._getOverviewZoom())
            }
        }
        ,
        i._updateSpatialReference = function() {
            if (this._overview) {
                var t = this.getMap().options.spatialReference;
                this._overview.setSpatialReference(t)
            }
        }
        ,
        i._updateBaseLayer = function() {
            if (this._overview) {
                var t = this.getMap().getBaseLayer();
                if (t) {
                    var e = t.layers
                      , i = 0;
                    if (e)
                        for (var n = 0, r = e.length; n < r; n++) {
                            if (e[n].isVisible()) {
                                i = n;
                                break
                            }
                        }
                    var o = t.toJSON()
                      , s = null;
                    e ? (s = o.layers[i].options).visible = !0 : s = o.options,
                    this._overview.setMinZoom(s.minZoom || null).setMaxZoom(s.maxZoom || null),
                    delete s.minZoom,
                    delete s.maxZoom,
                    delete o.options.canvas,
                    o.options.visible = !0,
                    o.options.renderer = "canvas";
                    var a = ca.fromJSON(o);
                    for (var h in t)
                        H(t[h]) && t.hasOwnProperty(h) && t[h] !== t.constructor.prototype[h] && (a[h] = t[h]);
                    this._overview.setBaseLayer(a)
                } else
                    this._overview.setBaseLayer(null)
            }
        }
        ,
        e
    }(Lu);
    Fu.mergeOptions({
        level: 4,
        position: {
            right: 1,
            bottom: 1
        },
        size: [300, 200],
        maximize: !0,
        symbol: {
            lineWidth: 3,
            lineColor: "#1bbc9b",
            polygonFill: "#1bbc9b",
            polygonOpacity: .4
        },
        containerClass: "maptalks-overview",
        buttonClass: "maptalks-overview-button"
    }),
    Qa.mergeOptions({
        overviewControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.overviewControl && (this.overviewControl = new Fu(this.options.overviewControl),
        this.addControl(this.overviewControl))
    });
    var Gu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function() {
            var t;
            if (this.options.custom)
                P(this.options.content) ? (t = gi("div")).innerHTML = this.options.content : t = this.options.content;
            else {
                if (t = gi("div", "maptalks-panel"),
                this.options.closeButton) {
                    var e = gi("a", "maptalks-close");
                    e.innerText = "\xd7",
                    e.href = "javascript:;",
                    e.onclick = function() {
                        t.style.display = "none"
                    }
                    ,
                    t.appendChild(e)
                }
                var i = gi("div", "maptalks-panel-content");
                i.innerHTML = this.options.content,
                t.appendChild(i)
            }
            return this.draggable = new Er(t,{
                cancelOn: this._cancelOn.bind(this),
                ignoreMouseleave: !0
            }),
            this.draggable.on("dragstart", this._onDragStart, this).on("dragging", this._onDragging, this).on("dragend", this._onDragEnd, this),
            this.options.draggable && this.draggable.enable(),
            t
        }
        ,
        i.update = function() {
            return this.draggable && (this.draggable.disable(),
            delete this.draggable),
            Lu.prototype.update.call(this)
        }
        ,
        i.setContent = function(t) {
            var e = this.options.content;
            return this.options.content = t,
            this.fire("contentchange", {
                old: e,
                new: t
            }),
            this.isVisible() && this.update(),
            this
        }
        ,
        i.getContent = function() {
            return this.options.content
        }
        ,
        i._cancelOn = function(t) {
            var e = (t.srcElement || t.target).tagName.toLowerCase();
            return "button" === e || "input" === e || "select" === e || "option" === e || "textarea" === e
        }
        ,
        i._onDragStart = function(t) {
            this._startPos = t.mousePos,
            this._startPosition = F({}, this.getPosition()),
            this.fire("dragstart", t)
        }
        ,
        i._onDragging = function(t) {
            var e = t.mousePos.sub(this._startPos)
              , i = this._startPosition
              , n = this.getPosition();
            ut(n.top) || (n.top = parseInt(i.top) + e.y),
            ut(n.bottom) || (n.bottom = parseInt(i.bottom) - e.y),
            ut(n.left) || (n.left = parseInt(i.left) + e.x),
            ut(n.right) || (n.right = parseInt(i.right) - e.x),
            this.setPosition(n),
            this.fire("dragging", t)
        }
        ,
        i._onDragEnd = function(t) {
            delete this._startPos,
            delete this._startPosition,
            this.fire("dragend", t)
        }
        ,
        i._getConnectPoints = function() {
            var t = this.getMap()
              , e = this.getContainerPoint()
              , i = this.getDOM()
              , n = parseInt(i.clientWidth)
              , r = parseInt(i.clientHeight);
            return [t.containerPointToCoordinate(e.add(n / 2, 0)), t.containerPointToCoordinate(e.add(n, r / 2)), t.containerPointToCoordinate(e.add(n / 2, r)), t.containerPointToCoordinate(e.add(0, r / 2))]
        }
        ,
        e
    }(Lu);
    Gu.mergeOptions({
        position: "top-right",
        draggable: !0,
        custom: !1,
        content: "",
        closeButton: !0
    });
    var Hu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function() {
            var t = this._getReset();
            return this._reset = t,
            this._registerDomEvents(),
            t
        }
        ,
        i.onAdd = function() {
            this._view = this.options.view ? this.options.view : this.getMap().getView()
        }
        ,
        i.setView = function(t) {
            this._view = t
        }
        ,
        i._getReset = function() {
            return gi("div", "maptalks-reset")
        }
        ,
        i._registerDomEvents = function() {
            Ii(this._reset, "click", this._resetView, this)
        }
        ,
        i.onRemove = function() {
            delete this._reset,
            delete this._view
        }
        ,
        i._resetView = function() {
            this.getMap().setView(this._view)
        }
        ,
        e
    }(Lu);
    Hu.mergeOptions({
        position: {
            top: 156,
            left: 20
        },
        view: null
    }),
    Qa.mergeOptions({
        resetControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.resetControl && (this.resetControl = new Hu(this.options.resetControl),
        this.addControl(this.resetControl))
    });
    var Bu = "zoomend moving moveend"
      , Nu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function(t) {
            return this._map = t,
            this._scaleContainer = gi("div", this.options.containerClass),
            this._addScales(),
            t.on(Bu, this._update, this),
            this._map._loaded && this._update(),
            this._scaleContainer
        }
        ,
        i.onRemove = function() {
            this.getMap().off(Bu, this._update, this)
        }
        ,
        i._addScales = function() {
            var t = "border: 2px solid #000000;border-top: none;line-height: 1.1;padding: 0px;color: #000000;font-size: 11px;text-align:center;white-space: nowrap;overflow: hidden;-moz-box-sizing: content-box;box-sizing: content-box;background: #fff; background: rgba(255, 255, 255, 0);";
            this.options.metric && (this._mScale = pi("div", this.options.containerClass ? null : t, this._scaleContainer)),
            this.options.imperial && (this._iScale = pi("div", this.options.containerClass ? null : t, this._scaleContainer))
        }
        ,
        i._update = function() {
            var t = this._map.pixelToDistance(this.options.maxWidth, 0);
            this._updateScales(t)
        }
        ,
        i._updateScales = function(t) {
            this.options.metric && t && this._updateMetric(t),
            this.options.imperial && t && this._updateImperial(t)
        }
        ,
        i._updateMetric = function(t) {
            var e = this._getRoundNum(t)
              , i = e < 1e3 ? e + " m" : e / 1e3 + " km";
            this._updateScale(this._mScale, i, e / t)
        }
        ,
        i._updateImperial = function(t) {
            var e, i, n, r = 3.2808399 * t;
            5280 < r ? (e = r / 5280,
            i = this._getRoundNum(e),
            this._updateScale(this._iScale, i + " mile", i / e)) : (n = this._getRoundNum(r),
            this._updateScale(this._iScale, n + " feet", n / r))
        }
        ,
        i._updateScale = function(t, e, i) {
            t.style.width = Math.round(this.options.maxWidth * i) + "px",
            t.innerHTML = e
        }
        ,
        i._getRoundNum = function(t) {
            var e = Math.pow(10, (Math.floor(t) + "").length - 1)
              , i = t / e;
            return e * (i = 10 <= i ? 10 : 5 <= i ? 5 : 3 <= i ? 3 : 2 <= i ? 2 : 1)
        }
        ,
        e
    }(Lu);
    Nu.mergeOptions({
        position: "bottom-left",
        maxWidth: 100,
        metric: !0,
        imperial: !1,
        containerClass: null
    }),
    Qa.mergeOptions({
        scaleControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.scaleControl && (this.scaleControl = new Nu(this.options.scaleControl),
        this.addControl(this.scaleControl))
    });
    var Zu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function(t) {
            this._map = t;
            var e = gi("div")
              , i = gi("ul", "maptalks-toolbar-hx");
            e.appendChild(i),
            this.options.vertical ? Ei(e, "maptalks-toolbar-vertical") : Ei(e, "maptalks-toolbar-horizonal");
            var s = this;
            function n(e, i, n, r) {
                var o = s._getItems()[i];
                return function(t) {
                    return wi(t),
                    e({
                        target: o,
                        index: i,
                        childIndex: n,
                        dom: r
                    })
                }
            }
            var r = this.options.items;
            if (St(r))
                for (var o = 0, a = r.length; o < a; o++) {
                    var h = r[o]
                      , l = gi("li");
                    if (28 !== this.options.height && (l.style.lineHeight = this.options.height + "px"),
                    l.style.height = this.options.height + "px",
                    l.style.cursor = "pointer",
                    Oi(h.item)) {
                        l.style.textAlign = "center";
                        var u = Li("div", h.item);
                        l.innerHTML = '<div style="margin-top:' + (this.options.height - u.height) / 2 + 'px;">' + h.item + "</div>"
                    } else
                        l.innerHTML = h.item;
                    if (h.click && Ii(l, "click", n(h.click, o, null, l)),
                    St(h.children)) {
                        var c = this._createDropMenu(o);
                        l.appendChild(c),
                        l._menu = c,
                        Ii(l, "mouseover", function() {
                            this._menu.style.display = ""
                        }),
                        Ii(l, "mouseout", function() {
                            this._menu.style.display = "none"
                        })
                    }
                    i.appendChild(l)
                }
            return e
        }
        ,
        i._createDropMenu = function(t) {
            var o = this;
            function e(e, i, n) {
                var r = o._getItems()[i].children[n];
                return function(t) {
                    return wi(t),
                    e({
                        target: r,
                        index: i,
                        childIndex: n
                    })
                }
            }
            var i = gi("div", "maptalks-dropMenu")
              , n = this._getItems()
              , r = n.length
              , s = gi("ul")
              , a = n[t].children;
            t === r - 1 && a && (i.style.cssText = "right: 0px;",
            s.style.cssText = "right: 0px;position: absolute;",
            this.options.reverseMenu && (s.style.bottom = 0)),
            i.appendChild(gi("em", "maptalks-ico"));
            for (var h = 0, l = 0, u = a.length; l < u; l++) {
                var c = Ge(a[l].item, "12px");
                c.width > h && (h = c.width)
            }
            for (var d = 0, f = a.length; d < f; d++) {
                var g = a[d]
                  , p = gi("li");
                p.innerHTML = '<a href="javascript:;">' + g.item + "</a>",
                p.style.cursor = "pointer",
                p.style.width = h + 24 + "px",
                Ii(p.childNodes[0], "click", e(g.click, t, d)),
                s.appendChild(p)
            }
            if (this.options.vertical) {
                var m = h < 95 ? 95 : h;
                this.options.reverseMenu ? i.style.right = -(m + 20 + 2) + "px" : i.style.left = -(m + 20 + 2) + "px"
            } else
                this.options.reverseMenu ? i.style.bottom = "28px" : i.style.top = "29px";
            return i.appendChild(s),
            i.style.display = "none",
            i
        }
        ,
        i._getItems = function() {
            return this.options.items || []
        }
        ,
        e
    }(Lu);
    Zu.mergeOptions({
        height: 28,
        vertical: !1,
        position: "top-right",
        reverseMenu: !1,
        items: {}
    });
    var Wu = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.buildOn = function(t) {
            var e = this.options
              , i = gi("div", "maptalks-zoom");
            if (e.zoomLevel) {
                var n = gi("span", "maptalks-zoom-zoomlevel")
                  , r = gi("span", "maptalks-zoom-zoomlevel-text");
                n.appendChild(r),
                i.appendChild(n),
                this._levelDOM = r
            }
            var o = gi("div", "maptalks-zoom-slider")
              , s = gi("a", "maptalks-zoom-zoomin");
            s.href = "javascript:;",
            o.appendChild(s),
            this._zoomInButton = s;
            var a = gi("a", "maptalks-zoom-zoomout");
            return a.href = "javascript:;",
            o.appendChild(a),
            this._zoomOutButton = a,
            i.appendChild(o),
            t.on("_zoomend _zooming _zoomstart _spatialreferencechange", this._update, this),
            this._update(),
            this._registerDomEvents(),
            i
        }
        ,
        i.onRemove = function() {
            this.getMap().off("_zoomend _zooming _zoomstart _spatialreferencechange", this._update, this)
        }
        ,
        i._update = function() {
            this._updateText()
        }
        ,
        i._updateText = function() {
            if (this._levelDOM) {
                var t = this.getMap().getZoom();
                c(t) || (t = Math.floor(10 * t) / 10),
                this._levelDOM.innerHTML = t
            }
        }
        ,
        i._registerDomEvents = function() {
            this._zoomInButton && Ii(this._zoomInButton, "click", this._onZoomInClick, this),
            this._zoomOutButton && Ii(this._zoomOutButton, "click", this._onZoomOutClick, this)
        }
        ,
        i._onZoomInClick = function(t) {
            xi(t),
            this.getMap().zoomIn()
        }
        ,
        i._onZoomOutClick = function(t) {
            xi(t),
            this.getMap().zoomOut()
        }
        ,
        e
    }(Lu);
    Wu.mergeOptions({
        position: "top-left",
        zoomLevel: !0,
        seamless: !1
    }),
    Qa.mergeOptions({
        zoomControl: !1
    }),
    Qa.addOnLoadHook(function() {
        this.options.zoomControl && (this.zoomControl = new Wu(this.options.zoomControl),
        this.addControl(this.zoomControl))
    });
    var Vu = Object.freeze({
        Control: Lu,
        Attribution: Iu,
        Compass: zu,
        LayerSwitcher: ju,
        Overview: Fu,
        Panel: Gu,
        Reset: Hu,
        Scale: Nu,
        Toolbar: Zu,
        Zoom: Wu
    })
      , Uu = function() {
        function t(t, e, i, n) {
            Array.isArray(t) ? (this.scale = {
                x: t[0],
                y: t[1]
            },
            this.origin = {
                x: t[2],
                y: t[3]
            }) : (this.scale = {
                x: t,
                y: e
            },
            this.origin = {
                x: i,
                y: n
            })
        }
        return t.getDefault = function(t) {
            var e = t.code.toLowerCase();
            return "baidu" === e ? "baidu" : e === "EPSG:4326".toLowerCase() || e === "EPSG:4490".toLowerCase() ? "tms-global-geodetic" : "identity" === e ? [1, -1, 0, 0] : "web-mercator"
        }
        ,
        t
    }()
      , Ju = 6378137 * Math.PI;
    F(Uu, {
        "web-mercator": new Uu([1, -1, -Ju, Ju]),
        "tms-global-mercator": new Uu([1, 1, -Ju, -Ju]),
        "tms-global-geodetic": new Uu([1, 1, -180, -90]),
        baidu: new Uu([1, 1, 0, 0])
    });
    for (var qu = function() {
        function t(t, e, i, n) {
            this.map = t,
            this.tileSize = n,
            this.fullExtent = i,
            this.prepareTileInfo(e, i),
            this._xScale = i.right >= i.left ? 1 : -1,
            this._yScale = i.top >= i.bottom ? 1 : -1;
            var r = t.getGLRes();
            this._pointOrigin = t._prjToPointAtRes(new dt(this.tileSystem.origin), r),
            this._glRes = r
        }
        var e = t.prototype;
        return e.prepareTileInfo = function(t, e) {
            if (P(t) ? t = Uu[t.toLowerCase()] : Array.isArray(t) && (t = new Uu(t)),
            !t)
                throw new Error("Invalid TileSystem");
            this.tileSystem = t;
            var i = e.right > e.left ? 1 : -1
              , n = e.top > e.bottom ? -1 : 1
              , r = t.origin.x
              , o = t.origin.y;
            this.transformation = new Ur([i, n, r, o])
        }
        ,
        e._getTileNum = function(t, e) {
            var i = this.tileSystem
              , n = this.tileSize
              , r = Math.floor(1e-7 * i.scale.x + t.x / (n.width * e))
              , o = Math.ceil(1e-7 * i.scale.y + t.y / (n.height * e));
            return {
                x: i.scale.x * r,
                y: i.scale.y * o
            }
        }
        ,
        e.getTileIndex = function(t, e, i) {
            var n = this.tileSystem
              , r = this.transformation.transform(t, 1)
              , o = this._getTileNum(r, e);
            return n.scale.x < 0 && (o.x -= 1),
            0 < n.scale.y && (o.y -= 1),
            this.getNeighorTileIndex(o.x, o.y, 0, 0, e, i)
        }
        ,
        e.getNeighorTileIndex = function(t, e, i, n, r, o) {
            var s = this.tileSystem
              , a = t + s.scale.x * i
              , h = e - s.scale.y * n
              , l = !1
              , u = a
              , c = h
              , d = this._getTileFullIndex(r);
            return o && (!0 !== o && "x" !== o || (d.xmax === d.xmin ? a = d.xmin : a < d.xmin ? (a = d.xmax - (d.xmin - a) % (d.xmax - d.xmin)) === d.xmax && (a = d.xmin) : a >= d.xmax && (a = d.xmin + (a - d.xmin) % (d.xmax - d.xmin))),
            !0 !== o && "y" !== o || (d.ymax === d.ymin ? h = d.ymin : h >= d.ymax ? h = d.ymin + (h - d.ymin) % (d.ymax - d.ymin) : h < d.ymin && (h = d.ymax - (d.ymin - h) % (d.ymax - d.ymin)) === d.ymax && (h = d.ymin))),
            (a < d.xmin || a > d.xmax || h > d.ymax || h < d.ymin) && (l = !0),
            {
                x: a,
                y: h,
                idx: u,
                idy: c,
                out: l
            }
        }
        ,
        e._getTileFullIndex = function(t) {
            if (this._tileFullIndex || (this._tileFullIndex = {}),
            this._tileFullIndex[t])
                return this._tileFullIndex[t];
            var e = this.fullExtent
              , i = this.transformation
              , n = this._getTileNum(i.transform(new Rr(e.left,e.top), 1), t)
              , r = this._getTileNum(i.transform(new Rr(e.right,e.bottom), 1), t)
              , o = this.tileSystem;
            return o.scale.x < 0 && (n.x -= 1,
            r.x -= 1),
            0 < o.scale.y && (n.y -= 1,
            r.y -= 1),
            this._tileFullIndex[t] = new Zr(n,r),
            this._tileFullIndex[t]
        }
        ,
        e.getTilePrjNW = function(t, e, i, n) {
            var r = this.tileSystem
              , o = this.tileSize
              , s = r.origin.y + this._yScale * r.scale.y * (e + (1 === r.scale.y ? 1 : 0)) * i * o.height
              , a = r.origin.x + this._xScale * r.scale.x * (t + (1 === r.scale.x ? 0 : 1)) * i * o.width;
            return n ? (n.set(a, s),
            n) : new Rr(a,s)
        }
        ,
        e.getTilePointNW = function(t, e, i, n) {
            var r = this._glRes / i
              , o = this.tileSystem
              , s = this.tileSize
              , a = this._pointOrigin.y * r + this._yScale * o.scale.y * (e + (1 === o.scale.y ? 1 : 0)) * s.height
              , h = this._pointOrigin.x * r + this._xScale * o.scale.x * (t + (1 === o.scale.x ? 0 : 1)) * s.width;
            return n ? (n.set(h, a),
            n) : new dt(h,a)
        }
        ,
        e.getTilePrjSE = function(t, e, i, n) {
            var r = this.tileSystem
              , o = this.tileSize
              , s = r.origin.y + this._yScale * r.scale.y * (e + (1 === r.scale.y ? 0 : 1)) * i * o.height
              , a = r.origin.x + this._xScale * r.scale.x * (t + (1 === r.scale.x ? 1 : 0)) * i * o.width;
            return n ? (n.set(a, s),
            n) : new Rr(a,s)
        }
        ,
        e.getTilePointSE = function(t, e, i, n) {
            var r = this._glRes / i
              , o = this.tileSystem
              , s = this.tileSize
              , a = this._pointOrigin.y * r + this._yScale * o.scale.y * (e + (1 === o.scale.y ? 0 : 1)) * s.height
              , h = this._pointOrigin.x * r + this._xScale * o.scale.x * (t + (1 === o.scale.x ? 1 : 0)) * s.width;
            return n ? (n.set(h, a),
            n) : new dt(h,a)
        }
        ,
        e.getTilePrjExtent = function(t, e, i) {
            var n = this.getTilePrjNW(t, e, i)
              , r = this.getTilePrjSE(t, e, i);
            return new Zr(n,r)
        }
        ,
        t
    }(), Xu = [], Yu = 0; Yu < 6; Yu++)
        Xu[Yu] = [];
    var Qu = [];
    function Ku(t, e, i) {
        var n, r, o, s, a, h, l, u, c, d, f, g, p, m, _, v, y, x, w;
        r = (n = t)[0],
        o = n[1],
        s = n[2],
        a = n[3],
        h = n[4],
        l = n[5],
        u = n[6],
        c = n[7],
        d = n[8],
        f = n[9],
        g = n[10],
        p = n[11],
        m = n[12],
        _ = n[13],
        v = n[14],
        y = n[15],
        tc(Xu[0], a - r, c - h, p - d, y - m),
        tc(Xu[1], a + r, c + h, p + d, y + m),
        tc(Xu[2], a + o, c + l, p + f, y + _),
        tc(Xu[3], a - o, c - l, p - f, y - _),
        tc(Xu[4], a - s, c - u, p - g, y - v),
        tc(Xu[5], a + s, c + u, p + g, y + v);
        for (var C = 0; C < 6; C++)
            if (!i || "0" !== i.charAt(C)) {
                var b = Xu[C];
                if (Qu[0] = 0 < b[0] ? e[1][0] : e[0][0],
                Qu[1] = 0 < b[1] ? e[1][1] : e[0][1],
                Qu[2] = 0 < b[2] ? e[1][2] : e[0][2],
                w = Qu,
                (x = b)[0] * w[0] + x[1] * w[1] + x[2] * w[2] + x[3] < 0)
                    return !1
            }
        return !0
    }
    var $u = 1 / 6;
    function tc(t, e, i, n, r) {
        return t[0] = e * $u,
        t[1] = i * $u,
        t[2] = n * $u,
        t[3] = r * $u,
        t
    }
    var ec = new dt(0,0)
      , ic = "undefined" != typeof Set
      , nc = function() {
        function t() {
            this._table = ic ? new Set : {}
        }
        var e = t.prototype;
        return e.add = function(t) {
            ic ? this._table.add(t) : this._table[t] = !0
        }
        ,
        e.has = function(t) {
            return ic ? this._table.has(t) : this._table[t]
        }
        ,
        e.reset = function() {
            ic ? this._table.clear() : this._table = {}
        }
        ,
        t
    }()
      , rc = {
        urlTemplate: null,
        subdomains: null,
        errorUrl: null,
        repeatWorld: !0,
        background: !0,
        loadingLimitOnInteracting: 3,
        loadingLimit: 0,
        tileRetryCount: 0,
        placeholder: !1,
        crossOrigin: null,
        tileSize: [256, 256],
        offset: [0, 0],
        tileSystem: null,
        fadeAnimation: !f,
        fadeDuration: 1e3 / 60 * 10,
        debug: !1,
        spatialReference: null,
        maxCacheSize: 256,
        renderer: $.webgl ? "gl" : "canvas",
        clipByPitch: !0,
        maxAvailableZoom: null,
        cascadeTiles: !0,
        zoomOffset: 0,
        pyramidMode: 1,
        decodeImageInWorker: !1,
        tileLimitPerFrame: 0,
        tileStackStartDepth: 7,
        tileStackDepth: 6,
        awareOfTerrain: !0,
        bufferPixel: .5,
        mipmapTexture: !0,
        depthMask: !0,
        currentTilesFirst: !0
    }
      , oc = /\{ *([\w_]+) *\}/g
      , sc = new dt(0,0)
      , ac = new dt(0,0)
      , hc = new dt(0,0)
      , lc = new dt(0,0)
      , uc = new dt(0,0)
      , cc = new dt(0,0)
      , dc = [[0, 0, 0], [0, 0, 0]]
      , fc = [0, 0, 0]
      , gc = [0, 0, 0]
      , pc = []
      , mc = function(i) {
        function e() {
            return i.apply(this, arguments) || this
        }
        it(e, i),
        e.fromJSON = function(t) {
            return t && "TileLayer" === t.type ? new e(t.id,t.options) : null
        }
        ;
        var t = e.prototype;
        return t.forceReload = function() {
            return this.fire("forcereloadstart"),
            this.clear(),
            this.load(),
            this.fire("forcereloadend"),
            this
        }
        ,
        t.getTileSize = function() {
            if (this._tileSize)
                return this._tileSize;
            var t = this.options.tileSize;
            return G(t) && (t = [t, t]),
            this._tileSize = new Oe(t),
            this._tileSize
        }
        ,
        t.getTiles = function(t, e) {
            return this._coordCache = {},
            this._isPyramidMode() ? this._getPyramidTiles(t, e) : this._getCascadeTiles(t, e)
        }
        ,
        t._isPyramidMode = function() {
            var t = this.getSpatialReference();
            return !this._disablePyramid && !this._hasOwnSR && this.options.pyramidMode && t && t.isPyramid()
        }
        ,
        t._getTileFullExtent = function() {
            if (this._tileFullExtent)
                return this._tileFullExtent;
            var t = this.getSpatialReference()
              , e = t.getFullExtent()
              , i = t.getResolution(0)
              , n = this.getMap();
            return this._tileFullExtent = e.convertTo(function(t) {
                return n._prjToPointAtRes(t, i, ec)
            }),
            this._tileFullExtent
        }
        ,
        t._getRootNodes = function(t) {
            var e = this.getMap();
            if (this._rootNodes) {
                var i = this._rootNodes
                  , n = i.tiles
                  , r = i.mapWidth
                  , o = i.mapHeight;
                if (e.width !== r || e.height !== o) {
                    for (var s = this._getRootError(), a = 0; a < n.length; a++)
                        n[a].error = s;
                    this._rootNodes.mapWidth = e.width,
                    this._rootNodes.mapHeight = e.height
                }
                for (var h = 0; h < n.length; h++)
                    n[h].offset[0] = t[0],
                    n[h].offset[1] = t[1];
                return this._rootNodes
            }
            var l = this.getSpatialReference()
              , u = l.getResolution(0)
              , c = this._getTileConfig()
              , d = l.getFullExtent()
              , f = c.tileSystem
              , g = f.origin
              , p = f.scale
              , m = c.getTilePrjExtent(0, 0, u)
              , _ = m.getWidth()
              , v = m.getHeight()
              , y = Math.abs((g.x - d.left) / _);
            y = Math.ceil(y - 1e-5);
            var x = Math.abs((d.right - g.x) / _);
            x = Math.ceil(x - 1e-5);
            var w = Math.ceil(Math.abs(d.top - g.y) / v);
            w = Math.ceil(w - 1e-5);
            var C = Math.ceil(Math.abs(d.bottom - g.y) / v);
            if (32 < (x + y) * ((C = Math.ceil(C - 1e-5)) + w))
                return {
                    status: 0,
                    error: "Too many root nodes"
                };
            for (var b = this._getRootError(), P = [], M = -y; M < x; M++)
                for (var T = -w; T < C; T++) {
                    var S = p.y < 0 ? T : -(T + 1);
                    P.push(this.createTileNode(M, S, 0, M, S, u, b))
                }
            return this._rootNodes = {
                status: 1,
                tiles: P,
                mapWidth: e.width,
                mapHeight: e.height
            },
            this._getRootNodes(t)
        }
        ,
        t.createTileNode = function(t, e, i, n, r, o, s, a, h, l) {
            var u = this.getMap()
              , c = this.options.zoomOffset;
            h || (h = this._getTileConfig().getTilePrjExtent(t, e, o).convertTo(function(t) {
                return u._prjToPointAtRes(t, o, ec)
            }));
            var d = this._getTileOffset(i);
            return {
                parent: a,
                layer: this.getId(),
                x: t,
                y: e,
                z: i,
                idx: n,
                idy: r,
                res: o,
                extent2d: h,
                id: l || this._getTileId(t, e, i),
                url: this.getTileUrl(t, e, i + c),
                offset: d,
                error: s,
                children: []
            }
        }
        ,
        t._getRootError = function() {
            var t = this.getMap()
              , e = w(t.getFov())
              , i = t.width / t.height
              , n = t.cameraPosition[2]
              , r = n * Math.tan(.5 * e)
              , o = r * i
              , s = Math.sqrt(n * n + r * r + o * o);
            return t._getFovZ(0) * (s / n) * this.getSpatialReference().getResolution(0) / t.getResolution(0)
        }
        ,
        t._getPyramidTiles = function(t, e) {
            var i = this.getMap();
            isNaN(+t) && (t = this._getTileZoom(i.getZoom()));
            var n, r = this.getSpatialReference(), o = Math.min(t, this.getMaxZoom(), this.getMaxAvailableZoom() || 1 / 0), s = i.projViewMatrix, a = this._getTileFullExtent(), h = this._getTileOffset(0);
            if (this.options.repeatWorld) {
                var l = i.getContainerExtent()
                  , u = this._convertToExtent2d(l)
                  , c = r.getResolution(0) / i.getResolution();
                if (u.within(a.copy()._scale(c))) {
                    var d = this._getRootNodes(h);
                    if (1 !== d.status)
                        return console.warn(d.error),
                        this._disablePyramid = !0,
                        this.getTiles(t, e);
                    n = d.tiles.concat()
                } else {
                    var f = i.getPitch()
                      , g = i.options.cascadePitches[1]
                      , p = Math.floor(i._getVisualHeight(g))
                      , m = f <= g ? l : new Vr(0,i.height - p,i.width,i.height);
                    this._visitedTiles = new nc;
                    var _ = this._getTiles(0 - this.options.zoomOffset, m, 2, e && e.getRenderer(), !0)
                      , v = this._getRootError() * Math.pow(2, this.options.zoomOffset);
                    _.tiles.forEach(function(t) {
                        t.error = v
                    }),
                    n = _.tiles
                }
            } else {
                var y = this._getRootNodes(h);
                if (1 !== y.status)
                    return console.warn(y.error),
                    this._disablePyramid = !0,
                    this.getTiles(t, e);
                n = y.tiles.concat()
            }
            for (var x = i.getGLRes(), w = {
                0: h
            }, C = new Vr, b = [], P = []; 0 < n.length; ) {
                var M = n.pop();
                M.z !== o ? (w[M.z + 1] || (w[M.z + 1] = this._getTileOffset(M.z + 1)),
                this._splitNode(M, s, n, b, C, o, w[M.z + 1], e && e.getRenderer(), x),
                this.isParentTile(t, o, M) && P.push(M)) : (C._combine(M.extent2d),
                b.push(M))
            }
            return P.sort(_c),
            {
                tileGrids: [{
                    extent: C,
                    count: b.length,
                    tiles: b,
                    parents: P,
                    offset: [0, 0],
                    zoom: t
                }],
                count: b.length
            }
        }
        ,
        t.isParentTile = function(t, e, i) {
            var n = Math.max(this.getMinZoom(), t - this.options.tileStackStartDepth)
              , r = Math.min(e, n + this.options.tileStackDepth);
            return i.z >= n && i.z < r
        }
        ,
        t._splitNode = function(t, e, i, n, r, o, s, a, h) {
            for (var l = t.z + 1, u = this.getSpatialReference(), c = t.idx, d = t.idy, f = a || this.getRenderer(), g = !1, p = [], m = u.getResolution(l) / h, _ = 0; _ < 4; _++) {
                var v = _ % 2
                  , y = _ >> 1
                  , x = (c << 1) + v
                  , w = (d << 1) + y;
                t.children || (t.children = []);
                var C = t.children[_];
                C || (C = this._getTileId(x, w, l),
                t.children[_] = C);
                var b = f.isTileCachedOrLoading(C)
                  , P = b && b.info;
                P || (this.tileInfoCache || (this.tileInfoCache = new bn(4 * this.options.maxCacheSize)),
                (P = this.tileInfoCache.get(C)) || (P = this._createChildNode(t, v, y, s, C))),
                P.error = t.error / 2,
                P.offset[0] = s[0],
                P.offset[1] = s[1];
                var M = this._isTileVisible(P, e, m, o, s);
                if (1 === M)
                    g = !0;
                else {
                    if (-1 === M)
                        continue;
                    if (0 === M && l !== o)
                        return n.push(t),
                        void r._combine(t.extent2d)
                }
                p.push(P)
            }
            l === o ? g ? i.push.apply(i, p) : (n.push(t),
            r._combine(t.extent2d)) : i.push.apply(i, p)
        }
        ,
        t._createChildNode = function(t, e, i, n, r) {
            var o, s = t.x, a = t.y, h = t.idx, l = t.idy, u = t.extent2d, c = t.z + 1, d = (s << 1) + e, f = (a << 1) + i, g = (h << 1) + e, p = (l << 1) + i, m = u.getWidth() / 2 * 2, _ = u.getHeight() / 2 * 2, v = 2 * u.xmin, y = 2 * u.ymax, x = 2 * u.ymin, w = this._getTileConfig().tileSystem.scale.y;
            if (r = r || this._getTileId(g, p, c),
            w < 0) {
                var C = v + e * m
                  , b = y - i * _;
                o = new Vr(C,b - _,C + m,b)
            } else {
                var P = v + e * m
                  , M = x + i * _;
                o = new Vr(P,M,P + m,M + _)
            }
            var T = this.createTileNode(d, f, c, g, p, t.res / 2, t.error / 2, t.id, o, r);
            return this.tileInfoCache.add(r, T),
            T
        }
        ,
        t._isTileVisible = function(t, e, i, n, r) {
            if (0 === t.z)
                return 1;
            if (!this._isTileInFrustum(t, e, i, r))
                return -1;
            var o = this.options.maxError;
            return ut(o) && (o = 1),
            o <= this._getScreenSpaceError(t, i, n, r) ? 1 : 0
        }
        ,
        t._isTileInFrustum = function(t, e, i, n) {
            if (!this._zScale) {
                var r = this.getMap()
                  , o = r.getGLRes();
                this._zScale = r.altitudeToPoint(100, o) / 100
            }
            var s = this.getRenderer()
              , a = t.extent2d
              , h = a.xmin
              , l = a.ymin
              , u = a.xmax
              , c = a.ymax;
            dc[0][0] = (h - n[0]) * i,
            dc[0][1] = (l - n[1]) * i;
            var d = t.minAltitude || s && s.avgMinAltitude || 0;
            dc[0][2] = d * this._zScale,
            dc[1][0] = (u - n[0]) * i,
            dc[1][1] = (c - n[1]) * i;
            var f = t.maxAltitude || s && s.avgMaxAltitude || 0;
            return dc[1][2] = f * this._zScale,
            Ku(e, dc)
        }
        ,
        t._getScreenSpaceError = function(t, e, i, n) {
            var r = t.error
              , o = this.getMap()
              , s = t.extent2d
              , a = s.xmin
              , h = s.ymin
              , l = s.xmax
              , u = s.ymax;
            fc[0] = (a - n[0]) * e,
            fc[1] = (h - n[1]) * e,
            gc[0] = (l - n[0]) * e,
            gc[1] = (u - n[1]) * e;
            var c, d, f, g, p, m, _ = (c = fc,
            d = gc,
            f = o.cameraPosition,
            g = Math.max(c[0] - f[0], 0, f[0] - d[0]),
            p = Math.max(c[1] - f[1], 0, f[1] - d[1]),
            m = Math.max(c[2] - f[2], 0, f[2] - d[2]),
            Math.sqrt(g * g + p * p + m * m)), v = Math.max(Math.abs(_), 1e-7), y = Math.abs(t.z - i);
            return r * (o.height < 1e3 ? 1 : y <= 1 ? 1 : y <= 2 ? .7 : .605) / v
        }
        ,
        t._getCascadeTiles = function(t, e) {
            var i = this.getMap()
              , n = i.getPitch()
              , r = e && e.getRenderer()
              , o = i.getContainerExtent()
              , s = []
              , a = 0
              , h = this.getMinZoom()
              , l = i.options.cascadePitches[0]
              , u = i.options.cascadePitches[1]
              , c = Math.floor(i._getVisualHeight(u))
              , d = ut(t) ? this._getTileZoom(i.getZoom()) : t;
            if (this._visitedTiles = new nc,
            !ut(t) || !this.options.cascadeTiles || n <= l || !ut(h) && d <= h) {
                var f = n <= u ? o : new Vr(0,i.height - c,i.width,i.height)
                  , g = this._getTiles(d, f, 2, r);
                return g && (a += g.tiles.length,
                s.push(g)),
                {
                    tileGrids: s,
                    count: a
                }
            }
            var p = Math.floor(i._getVisualHeight(l))
              , m = new Vr(0,i.height - p,i.width,i.height)
              , _ = this._getTiles(d, m, 0, r);
            a += _ ? _.tiles.length : 0,
            s.push(_);
            var v, y, x = m.ymin, w = i.getSpatialReference().getZoomDirection(), C = w;
            if (u < n) {
                d - C <= h && (C = 0);
                var b = new Vr(0,i.height - c,i.width,x);
                a += (v = this._getTiles(d - C, b, 1, r)) ? v.tiles.length : 0,
                x = b.ymin,
                C += 4 * w,
                s.push(v)
            }
            if (h <= d - C) {
                var P = new Vr(0,o.ymin,i.width,x);
                a += (y = this._getTiles(d - C, P, 2, r)) ? y.tiles.length : 0,
                s.push(y)
            }
            return v && y && (s[1] = y,
            s[2] = v),
            {
                tileGrids: s,
                count: a
            }
        }
        ,
        t.getTileUrl = function(t, e, i) {
            var n = this.options.urlTemplate
              , r = "";
            if (this.options.subdomains) {
                var o = this.options.subdomains;
                if (St(o)) {
                    var s = (t + e) % o.length;
                    s < 0 && (s = 0),
                    r = o[s]
                }
            }
            if (H(n))
                return n(t, e, i, r);
            var a = {
                x: t,
                y: e,
                z: i,
                s: r
            };
            return this.options.token && (a.token = this.options.token),
            this.options.customTags && F(a, this.options.customTags),
            n.replace(oc, function(t, e) {
                var i = a[e];
                if (void 0 === i)
                    throw new Error("No value provided for variable " + t);
                return "function" == typeof i && (i = i(a)),
                i
            })
        }
        ,
        t.clear = function() {
            return this._renderer && this._renderer.clear(),
            this.tileInfoCache && this.tileInfoCache.reset(),
            this.fire("clear"),
            this
        }
        ,
        t.toJSON = function() {
            return {
                type: this.getJSONType(),
                id: this.getId(),
                options: this.config()
            }
        }
        ,
        t.getSpatialReference = function() {
            var t = this.getMap();
            if (t && (!this.options.spatialReference || ia.equals(this.options.spatialReference, t.options.spatialReference)))
                return t.getSpatialReference();
            if (this._sr)
                return this._sr;
            var e = this.options.spatialReference;
            if (P(e) && !(e = ia.getPreset(e)))
                throw new Error("Unsupported spatial reference: " + this.options.spatialReference + ", possible values: " + ia.getAllPresets().join());
            return this._sr = new ia(e),
            this._srMinZoom = this._sr.getMinZoom(),
            this._srMaxZoom = this._sr.getMaxZoom(),
            this._hasOwnSR = this._sr.toJSON().projection !== t.getSpatialReference().toJSON().projection,
            this._sr
        }
        ,
        t.getMinZoom = function() {
            var t = this.options.minZoom || 0;
            return this.getSpatialReference() !== this.getMap().getSpatialReference() ? Math.max(t, this._srMinZoom) : t
        }
        ,
        t.getMaxZoom = function() {
            return this.getSpatialReference() !== this.getMap().getSpatialReference() ? Math.min(i.prototype.getMaxZoom.call(this), this._srMaxZoom) : i.prototype.getMaxZoom.call(this)
        }
        ,
        t._getTileZoom = function(t) {
            if (!this._hasOwnSR) {
                var e = this.getMap().getResolution(t)
                  , i = this.getSpatialReference().getResolution(t);
                t += Math.log(i / e) * Math.LOG2E
            }
            var n = this.getMaxAvailableZoom();
            return !ut(n) && n < t && (t = n),
            c(t) || (t = Math.round(t)),
            t = Math.max(0, t)
        }
        ,
        t.getMaxAvailableZoom = function() {
            var t = this.getSpatialReference();
            return this.options.maxAvailableZoom || t && t.getMaxZoom()
        }
        ,
        t._getTiles = function(t, e, i, n, r) {
            var o = this.getMap()
              , s = t
              , a = o.projViewMatrix
              , h = o.getResolution(t) / o.getResolution(t - 1) == .5;
            i < 2 && (0 === i && h && (s -= 1),
            a = 0 === i ? o.cascadeFrustumMatrix0 : 1 === i ? o.cascadeFrustumMatrix1 : o.projViewMatrix);
            var l = s + this.options.zoomOffset
              , u = this._getTileOffset(s)
              , c = u[0] || u[1]
              , d = {
                zoom: s,
                extent: null,
                offset: u,
                tiles: []
            };
            if (l < 0)
                return d;
            if (!(o && this.isVisible() && o.width && o.height))
                return d;
            if (!r) {
                var f = this.getMinZoom()
                  , g = this.getMaxZoom();
                if (!ut(f) && s < f || !ut(g) && g < s)
                    return d
            }
            var p = this._getTileConfig();
            if (!p)
                return d;
            var m, _ = {
                zoom: u
            }, v = this.getSpatialReference().getResolution(s);
            m = this._hasOwnSR ? o.getGLScale(s) : v / o.getGLRes();
            var y = !this._hasOwnSR && this.options.repeatWorld
              , x = this._convertToExtent2d(e)
              , w = this._getMask2DExtent();
            if (w) {
                var C = w.intersection(x);
                if (!C)
                    return d;
                e = C.convertTo(function(t) {
                    return o._pointToContainerPoint(t, void 0, 0, ec)
                })
            }
            var b, P = o._containerPointToPrj(e.getCenter(), sc), M = o._prjToPoint(P, s, ac);
            b = c ? this._project(o._pointToPrj(M._add(u), s, ac), ac) : this._project(P, ac);
            var T = o.getGLScale() / o.getGLScale(s);
            hc.x = x.xmin * T,
            hc.y = x.ymax * T,
            lc.x = x.xmax * T,
            lc.y = x.ymin * T;
            for (var S = this._project(o._pointToPrj(hc._add(u), s, hc), hc), E = this._project(o._pointToPrj(lc._add(u), s, lc), lc), R = p.getTileIndex(b, v, y), A = p.getTileIndex(S, v, y), k = p.getTileIndex(E, v, y), O = Math.ceil(Math.abs(R.idy - A.idy)), L = Math.ceil(Math.abs(R.idx - A.idx)), D = Math.ceil(Math.abs(R.idy - k.idy)), I = Math.ceil(Math.abs(R.idx - k.idx)), z = (O + D + 1) * (L + I + 1), j = this.getTileSize(), F = this.getRenderer() || n, G = this._getTileConfig().tileSystem.scale, H = [], B = new Vr, N = new dt(0,0), Z = -O; Z <= D; Z++)
                for (var W = -L, V = -1 / 0, U = !1; V <= W && W <= I; ) {
                    var J = p.getNeighorTileIndex(R.idx, R.idy, W, Z, v, y);
                    V === -1 / 0 ? W++ : W--;
                    var q = this._getTileId(J.idx, J.idy, s);
                    if (!(J.out || this._visitedTiles && this._visitedTiles.has(q))) {
                        var X = F && F.isTileCachedOrLoading(q);
                        X && (X = X.info);
                        var Y = void 0;
                        if (X) {
                            var Q = X.extent2d;
                            N.set(Q.xmin, Q.ymax),
                            Y = N
                        } else if (this._hasOwnSR) {
                            var K = p.getTilePrjNW(J.x, J.y, v);
                            Y = o._prjToPoint(this._unproject(K, lc), s)
                        } else
                            Y = p.getTilePointNW(J.x, J.y, v);
                        var $ = void 0
                          , tt = void 0;
                        if (this._hasOwnSR) {
                            var et = void 0;
                            if (this._hasOwnSR) {
                                var it = p.getTilePrjSE(J.x, J.y, v);
                                et = o._prjToPoint(this._unproject(it, lc), s, lc)
                            } else
                                et = p.getTilePointSE(J.x, J.y, v);
                            $ = Math.ceil(Math.abs(et.x - Y.x)),
                            tt = Math.ceil(Math.abs(et.y - Y.y))
                        } else
                            $ = j.width,
                            tt = j.height;
                        var nt = G.x * (J.idx - J.x) * $
                          , rt = G.y * (J.idy - J.y) * tt;
                        X || !nt && !rt || Y._add(nt, rt);
                        var ot = X && X.extent2d || new Vr(Y.x,Y.y - tt,Y.x + $,Y.y);
                        if (z <= 4 || U || this._isTileInExtent(a, ot, u, m)) {
                            var st = this._hasOwnSR ? o._getResolution(s) : v;
                            this._visitedTiles && 0 === i && this._visitedTiles.add(q),
                            h && 0 === i ? this._splitTiles(a, H, F, J, s + 1, st, ot, nt, rt, _) : (X ? (X.offset[0] = u[0],
                            X.offset[1] = u[1]) : X = this.createTileNode(J.x, J.y, s, J.idx, J.idy, st, 0, null, ot, q),
                            H.push(X)),
                            B._combine(ot),
                            V === -1 / 0 ? (V = W,
                            W = I) : U || (U = !0)
                        }
                    }
                }
            if (H.length) {
                var at = o._containerPointToPoint(e.getCenter(), s, ec)._add(u)
                  , ht = new dt(0,0)
                  , lt = new dt(0,0);
                H.sort(function(t, e) {
                    return ht.set((t.extent2d.xmin + t.extent2d.xmax) / 2, (t.extent2d.ymin + t.extent2d.ymax) / 2),
                    lt.set((e.extent2d.xmin + e.extent2d.xmax) / 2, (e.extent2d.ymin + e.extent2d.ymax) / 2),
                    ht.distanceTo(at) - lt.distanceTo(at)
                })
            }
            return {
                offset: u,
                zoom: t,
                extent: B,
                tiles: H
            }
        }
        ,
        t._convertToExtent2d = function(t) {
            var i = this
              , n = this.getMap();
            return t.convertTo(function(t) {
                if (0 < t.y && t.y < n.height) {
                    var e = (0 === t.x ? 0 : 1) + t.y;
                    i._coordCache[e] || (i._coordCache[e] = n._containerPointToPoint(t)),
                    i._coordCache[e]
                }
                return n._containerPointToPoint(t, void 0, ec)
            })
        }
        ,
        t._splitTiles = function(t, e, i, n, r, o, s, a, h, l) {
            var u = this._getTileConfig().tileSystem.scale.y
              , c = this.getMap().getGLScale(r)
              , d = uc.set(2 * s.xmin, u < 0 ? 2 * s.ymax : 2 * s.ymin)
              , f = s.getWidth()
              , g = s.getHeight()
              , p = 2 * n.idx
              , m = 2 * n.idy
              , _ = 2 * n.x
              , v = 2 * n.y
              , y = this._checkAndAddTile(t, i, p, m, _, v, r, o, 0, 0, f, g, d, c, l);
            y && e.push(y),
            (y = this._checkAndAddTile(t, i, p, m, _, v, r, o, 0, 1, f, g, d, c, l)) && e.push(y),
            (y = this._checkAndAddTile(t, i, p, m, _, v, r, o, 1, 0, f, g, d, c, l)) && e.push(y),
            (y = this._checkAndAddTile(t, i, p, m, _, v, r, o, 1, 1, f, g, d, c, l)) && e.push(y)
        }
        ,
        t._checkAndAddTile = function(t, e, i, n, r, o, s, a, h, l, u, c, d, f, g) {
            var p = this._getTileId(i + h, n + l, s);
            if (this._visitedTiles && this._visitedTiles.has(p))
                return null;
            var m = g[s];
            m || (m = g[s] = this._getTileOffset(s));
            var _ = this._getTileConfig().tileSystem.scale.y
              , v = new Vr(d.x + h * u,d.y + _ * l * c,d.x + (h + 1) * u,d.y + _ * (l + 1) * c);
            if (!this._isSplittedTileInExtent(t, v, m, f))
                return null;
            var y = a / 2
              , x = e && e.isTileCachedOrLoading(p);
            return x = x ? x.info : this.createTileNode(r + h, o + l, s, i + h, i + o, y, 0, null, v, p)
        }
        ,
        t._getTileOffset = function() {
            var t = this.options.offset;
            if (H(t)) {
                for (var e, i = arguments.length, n = new Array(i), r = 0; r < i; r++)
                    n[r] = arguments[r];
                t = (e = t).call.apply(e, [this].concat(n))
            }
            return G(t) && (t = [t, t]),
            t || [0, 0]
        }
        ,
        t.getTileId = function(t, e, i, n) {
            return this._getTileId(t, e, i, n)
        }
        ,
        t._getTileId = function(t, e, i, n) {
            return (n || this.getId()) + "_" + t + "_" + e + "_" + i
        }
        ,
        t._project = function(t, e) {
            if (this._hasOwnSR) {
                var i = this.getMap().getProjection();
                return this.getSpatialReference().getProjection().project(i.unproject(t, e), e)
            }
            return t
        }
        ,
        t._unproject = function(t, e) {
            if (this._hasOwnSR) {
                var i = this.getMap()
                  , n = this.getSpatialReference()
                  , r = i.getProjection()
                  , o = n.getProjection();
                return r.project(o.unproject(t, e), e)
            }
            return t
        }
        ,
        t._initTileConfig = function() {
            var t = this.getMap()
              , e = this.getTileSize()
              , i = this.getSpatialReference()
              , n = i.getProjection()
              , r = i.getFullExtent();
            this._defaultTileConfig = new qu(t,Uu.getDefault(n),r,e),
            this.options.hasOwnProperty("tileSystem") && (this._tileConfig = new qu(t,this.options.tileSystem,r,e)),
            delete this._rootNodes,
            delete this._tileFullExtent,
            delete this._disablePyramid
        }
        ,
        t._getTileConfig = function() {
            return this._defaultTileConfig || this._initTileConfig(),
            this._tileConfig || this._defaultTileConfig
        }
        ,
        t._bindMap = function(t) {
            var e = t.getBaseLayer();
            return e === this && (e.options.hasOwnProperty("forceRenderOnMoving") || this.config({
                forceRenderOnMoving: !0
            })),
            this._onSpatialReferenceChange(),
            i.prototype._bindMap.apply(this, arguments)
        }
        ,
        t._isTileInExtent = function(t, e, i, n) {
            var r, o, s, a, h, l, u, c, d = this.getMap();
            if (t !== d.projViewMatrix) {
                var f = e.getCenter(cc)._sub(i[0], i[1])._multi(n);
                Ml(pc, f.x, f.y, 0),
                r = (s = o = pc,
                a = d.projViewMatrix,
                h = s[0],
                l = s[1],
                u = s[2],
                c = (c = a[3] * h + a[7] * l + a[11] * u + a[15]) || 1,
                o[0] = (a[0] * h + a[4] * l + a[8] * u + a[12]) / c,
                o[1] = (a[1] * h + a[5] * l + a[9] * u + a[13]) / c,
                o[2] = (a[2] * h + a[6] * l + a[10] * u + a[14]) / c,
                o)[1] < 0 ? d.projViewMatrix : t
            } else
                r = d.projViewMatrix;
            return dc[0][0] = (e.xmin - i[0]) * n,
            dc[0][1] = (e.ymin - i[1]) * n,
            dc[1][0] = (e.xmax - i[0]) * n,
            dc[1][1] = (e.ymax - i[1]) * n,
            Ku(r, dc)
        }
        ,
        t._isSplittedTileInExtent = function(t, e, i, n) {
            var r = this.getMap();
            return dc[0][0] = (e.xmin - i[0]) * n,
            dc[0][1] = (e.ymin - i[1]) * n,
            dc[1][0] = (e.xmax - i[0]) * n,
            dc[1][1] = (e.ymax - i[1]) * n,
            Ku(r.projViewMatrix, dc)
        }
        ,
        t.getEvents = function() {
            return {
                spatialreferencechange: this._onSpatialReferenceChange
            }
        }
        ,
        t._onSpatialReferenceChange = function() {
            delete this._tileConfig,
            delete this._defaultTileConfig,
            delete this._sr,
            delete this._srMinZoom,
            delete this._hasOwnSR,
            delete this._rootNodes,
            this.tileInfoCache && this.tileInfoCache.reset();
            var t = this.getRenderer();
            t && t.clear()
        }
        ,
        t.getPolygonOffsetCount = function() {
            return 2
        }
        ,
        t.getPolygonOffset = function() {
            return this._polygonOffset || 0
        }
        ,
        t.setPolygonOffset = function(t) {
            return this._polygonOffset = t,
            this
        }
        ,
        e
    }(ca);
    function _c(t, e) {
        return t.z - e.z
    }
    mc.registerJSONType("TileLayer"),
    mc.mergeOptions(rc);
    var vc = new Oe(256,256)
      , yc = "show hide remove setzindex forcereloadstart";
    function xc(t) {
        return Array.isArray(t) || (t = [t]),
        t
    }
    var wc = function(r) {
        function i(t, e, i) {
            var n;
            return (n = r.call(this, t, i) || this).layers = e || [],
            n._checkChildren(),
            n.layerMap = {},
            n._groupChildren = [],
            n
        }
        it(i, r),
        i.fromJSON = function(t) {
            if (!t || "GroupTileLayer" !== t.type)
                return null;
            var e = t.layers.map(function(t) {
                return ca.fromJSON(t)
            });
            return new i(t.id,e,t.options)
        }
        ;
        var t = i.prototype;
        return t.getLayers = function() {
            return this.layers
        }
        ,
        t.addLayer = function(t) {
            var e = this;
            void 0 === t && (t = []),
            t = xc(t);
            var i = this.layers.length;
            return t.forEach(function(t) {
                t instanceof mc && (-1 !== e.layers.indexOf(t) || e.layerMap[t.getId()] || e.layers.push(t))
            }),
            i !== this.layers.length && (this._sortLayers(),
            this._refresh(),
            this._renderLayers()),
            this
        }
        ,
        t.removeLayer = function(t) {
            var i = this;
            void 0 === t && (t = []),
            t = xc(t);
            var e = this.layers.length;
            return t.forEach(function(t) {
                if (t instanceof mc || (t = i.layerMap[t]),
                t instanceof mc) {
                    var e = i.layers.indexOf(t);
                    0 <= e && (i.layers.splice(e, 1),
                    t._doRemove(),
                    t.off(yc, i._onLayerShowHide, i))
                }
            }),
            e !== this.layers.length && (this._refresh(),
            this._renderLayers()),
            this
        }
        ,
        t.clearLayers = function() {
            var e = this;
            return this.layers.forEach(function(t) {
                t._doRemove(),
                t.off(yc, e._onLayerShowHide, e)
            }),
            this.layers = [],
            this._refresh(),
            this._renderLayers(),
            this
        }
        ,
        t.toJSON = function() {
            return {
                type: this.getJSONType(),
                id: this.getId(),
                layers: this.layers.map(function(t) {
                    return t.toJSON()
                }),
                options: this.config()
            }
        }
        ,
        t.getTileSize = function(t) {
            var e = this.getLayer(t);
            return e ? e.getTileSize() : vc
        }
        ,
        t.getTiles = function(t, e) {
            for (var i = this.layers, n = [], r = 0, o = 0, s = i.length; o < s; o++) {
                var a = i[o];
                if (a && a.options.visible && a.isVisible() && a.getMap()) {
                    var h = a.getTiles(t, e || this);
                    h && 0 !== h.count && (r += h.count,
                    yt(n, h.tileGrids))
                }
            }
            return {
                count: r,
                tileGrids: n
            }
        }
        ,
        t.onAdd = function() {
            this._sortLayers(),
            this._refresh(),
            r.prototype.onAdd.call(this)
        }
        ,
        t.onRemove = function() {
            var e = this;
            this.layers.forEach(function(t) {
                t._doRemove(),
                t.off(yc, e._onLayerShowHide, e)
            }),
            this.layerMap = {},
            this._groupChildren = [],
            r.prototype.onRemove.call(this)
        }
        ,
        t.getLayer = function(t) {
            return this.getChildLayer(t)
        }
        ,
        t.getChildLayer = function(t) {
            var e = this.layerMap[t];
            if (e)
                return e;
            for (var i = 0; i < this._groupChildren.length; i++) {
                var n = this._groupChildren[i].getChildLayer(t);
                if (n)
                    return n
            }
            return null
        }
        ,
        t._removeChildTileCache = function(t) {
            if (!t)
                return this;
            var e, i = this.getRenderer();
            if (!i)
                return this;
            var n = t.getId()
              , r = function() {
                return e && e.info && e.info.layer === n
            };
            i.tileCache && i.tileCache.keys().forEach(function(t) {
                e = i.tileCache.get(t),
                r() && i.tileCache.remove(t)
            });
            var o = i.tilesInView || {};
            for (var s in o)
                e = o[s],
                r() && delete o[s];
            var a = i.tilesLoading || {};
            for (var h in a)
                e = a[h],
                r() && i.abortTileLoading(e.image, e.info);
            return this
        }
        ,
        t._onLayerShowHide = function(t) {
            var e = t || {}
              , i = e.type
              , n = e.target;
            return "remove" === i && n ? (this.layers.splice(this.layers.indexOf(n), 1),
            n._doRemove(),
            n.off(yc, this._onLayerShowHide, this),
            this._refresh()) : "setzindex" === i ? this._sortLayers() : "forcereloadstart" === i && this._removeChildTileCache(n),
            this._renderLayers(),
            this
        }
        ,
        t._renderLayers = function() {
            var t = this.getRenderer();
            return t && t.setToRedraw(),
            this
        }
        ,
        t._refresh = function() {
            var e = this
              , i = this.getMap();
            return this._groupChildren = [],
            this.layerMap = {},
            this.layers.forEach(function(t) {
                (e.layerMap[t.getId()] = t).getChildLayer && e._groupChildren.push(t),
                t.getMap() || t._bindMap(i),
                t.off(yc, e._onLayerShowHide, e),
                t.on(yc, e._onLayerShowHide, e)
            }),
            this
        }
        ,
        t.isVisible = function() {
            if (!r.prototype.isVisible.call(this))
                return !1;
            for (var t = this.layers, e = 0, i = t.length; e < i; e++)
                if (t[e].isVisible())
                    return !0;
            return !1
        }
        ,
        t._checkChildren = function() {
            var i = this
              , n = {};
            this.layers.forEach(function(t) {
                var e = t.getId();
                if (n[e])
                    throw new Error("Duplicate child layer id (" + e + ") in the GroupTileLayer (" + i.getId() + ")");
                n[e] = 1
            })
        }
        ,
        t._sortLayers = function() {
            this.layers.sort(function(t, e) {
                return t.options.zIndex - e.options.zIndex
            })
        }
        ,
        i
    }(mc);
    wc.registerJSONType("GroupTileLayer"),
    wc.mergeOptions({
        maxCacheSize: 1024
    });
    var Cc, bc = {
        crs: null,
        uppercase: !1,
        detectRetina: !1
    }, Pc = {
        service: "WMS",
        request: "GetMap",
        layers: "",
        styles: "",
        format: "image/jpeg",
        transparent: !1,
        version: "1.1.1"
    }, Mc = function(l) {
        function e(t, e) {
            var i;
            return i = l.call(this, t) || this,
            Cc || (Cc = F({}, i.options)),
            i.wmsParams = F({}, Pc),
            i.setOptions(e),
            i.setZIndex(e.zIndex),
            $.proxy || i._optionsHook(e),
            i
        }
        it(e, l);
        var t = e.prototype;
        return t._optionsHook = function(t) {
            for (var e in void 0 === t && (t = {}),
            t)
                "tileSize" === e && (this._tileSize = null),
                e in Cc || (this.wmsParams[e] = t[e]);
            var i = this.getTileSize();
            return this.wmsParams.width = i.width,
            this.wmsParams.height = i.height,
            this._wmsVersion = parseFloat(this.wmsParams.version),
            this
        }
        ,
        t.onAdd = function() {
            var t = this.getMap().getDevicePixelRatio()
              , e = bc.detectRetina ? t : 1;
            this.wmsParams.width *= e,
            this.wmsParams.height *= e;
            var i = this.options.crs || this.getMap().getProjection().code
              , n = 1.3 <= this._wmsVersion ? "crs" : "srs";
            this.wmsParams[n] = i,
            l.prototype.onAdd.call(this)
        }
        ,
        t.getTileUrl = function(t, e, i) {
            var n = this.getSpatialReference().getResolution(i)
              , r = this._getTileConfig().getTilePrjExtent(t, e, n)
              , o = r.getMax()
              , s = r.getMin()
              , a = (1.3 <= this._wmsVersion && ("EPSG:4326" === this.wmsParams.crs || "EPSG:4490" === this.wmsParams.crs) ? [s.y, s.x, o.y, o.x] : [s.x, s.y, o.x, o.y]).join(",")
              , h = l.prototype.getTileUrl.call(this, t, e, i);
            return h + function(t, e, i) {
                var n = [];
                for (var r in t)
                    n.push(encodeURIComponent(i ? r.toUpperCase() : r) + "=" + encodeURIComponent(t[r]));
                return (e && -1 !== e.indexOf("?") ? "&" : "?") + n.join("&")
            }(this.wmsParams, h, this.options.uppercase) + (this.options.uppercase ? "&BBOX=" : "&bbox=") + a
        }
        ,
        t.toJSON = function() {
            return {
                type: "WMSTileLayer",
                id: this.getId(),
                options: this.config()
            }
        }
        ,
        e.fromJSON = function(t) {
            return t && "WMSTileLayer" === t.type ? new e(t.id,t.options) : null
        }
        ,
        e
    }(mc);
    Mc.registerJSONType("WMSTileLayer"),
    Mc.mergeOptions(bc);
    var Tc = function(n) {
        function e(t, e) {
            var i;
            return (i = n.call(this, t, e) || this).options.hasOwnProperty("forceRenderOnMoving") || (i.options.forceRenderOnMoving = !1),
            i
        }
        it(e, n);
        var t = e.prototype;
        return t.drawTile = function() {}
        ,
        t.toJSON = function() {
            return {
                type: "CanvasTileLayer",
                id: this.getId(),
                options: this.config()
            }
        }
        ,
        e.fromJSON = function(t) {
            return t && "CanvasTileLayer" === t.type ? new e(t.id,t.options) : null
        }
        ,
        e
    }(mc);
    function Sc(t, e, i) {
        var n = t.createShader(e);
        if (t.shaderSource(n, i),
        t.compileShader(n),
        !t.getShaderParameter(n, t.COMPILE_STATUS)) {
            var r = t.getShaderInfoLog(n);
            throw t.deleteShader(n),
            new Error("Failed to compile shader: " + r)
        }
        return n
    }
    function Ec(t, e, i) {
        var n = Sc(t, t.VERTEX_SHADER, e)
          , r = Sc(t, t.FRAGMENT_SHADER, i);
        if (!n || !r)
            return null;
        var o = t.createProgram();
        return o ? (t.attachShader(o, n),
        t.attachShader(o, r),
        t.linkProgram(o),
        {
            program: o,
            vertexShader: n,
            fragmentShader: r
        }) : null
    }
    function Rc(t, e, i) {
        if (Array.isArray(i[0])) {
            for (var n = Float32Array.BYTES_PER_ELEMENT, r = 0, o = 0; o < i.length; o++)
                r += i[o][1] || 0;
            for (var s = 0, a = 0; a < i.length; a++) {
                var h = t.getAttribLocation(e, i[a][0]);
                if (h < 0)
                    throw new Error("Failed to get the storage location of " + i[a][0]);
                t.vertexAttribPointer(h, i[a][1], t[i[a][2] || "FLOAT"], !1, n * r, n * s),
                s += i[a][1] || 0,
                t.enableVertexAttribArray(h)
            }
        } else {
            var l = t.getAttribLocation(e, i[0]);
            t.vertexAttribPointer(l, i[1], t[i[2] || "FLOAT"], !1, 0, 0),
            t.enableVertexAttribArray(l)
        }
    }
    Tc.registerJSONType("CanvasTileLayer");
    var Ac = {
        never: 512,
        "<": 513,
        "=": 514,
        "<=": 515,
        ">": 516,
        "!=": 517,
        ">=": 518,
        always: 519
    };
    var kc = [1, 1, 1, 1]
      , Oc = "\n        attribute vec2 a_position;\n\n        attribute vec2 a_texCoord;\n\n        uniform mat4 u_matrix;\n\n        varying vec2 v_texCoord;\n\n        void main() {\n            gl_Position = u_matrix * vec4(a_position, 0., 1.);\n\n            v_texCoord = a_texCoord;\n        }\n    "
      , Lc = "\n        precision mediump float;\n\n        uniform sampler2D u_image;\n\n        uniform float u_opacity;\n        uniform float u_debug_line;\n        uniform vec4 u_base_color;\n        uniform float u_alpha_test;\n        varying vec2 v_texCoord;\n\n        void main() {\n            if (u_debug_line == 1.) {\n                gl_FragColor = vec4(0., 1., 0., 1.);\n            } else {\n                gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n            }\n            gl_FragColor *= u_base_color;\n            if (gl_FragColor.a < u_alpha_test) {\n                discard;\n            }\n        }\n    "
      , Dc = [0, 0]
      , Ic = [0, 0, 0]
      , zc = new Array(16)
      , jc = new dt(20,20)
      , Fc = function(t) {
        var h, l, e = function(t) {
            function e() {
                return t.apply(this, arguments) || this
            }
            it(e, t);
            var i = e.prototype;
            return i.drawGLImage = function(t, e, i, n, r, o, s, a, h) {
                this.gl.program !== this.program && this.useProgram(this.program);
                var l = this.gl;
                if (this.loadTexture(t),
                this.canvas.gl && this.canvas.gl.wrap) {
                    var u = this.layer && this.layer.options.opacity;
                    ut(u) && (u = 1),
                    s *= u
                }
                Ic[0] = e || 0,
                Ic[1] = i || 0,
                Ic[2] = 0;
                var c = this.layer;
                if (c) {
                    var d = c.options.altitude
                      , f = G(d);
                    if (f || (this._layerAlt = 0),
                    this._layerAltitude !== d && f) {
                        var g = c.getMap();
                        if (g) {
                            var p = g.altitudeToPoint(d, g.getGLRes());
                            this._layerAltitude = d,
                            this._layerAlt = p
                        }
                    }
                }
                Ic[2] = this._layerAlt || 0;
                var m = bl(zc);
                yl(m, m, Ic),
                xl(m, m, [o, o, 1]),
                wl(m, this.getMap().projViewMatrix, m),
                l.uniformMatrix4fv(this.program.u_matrix, !1, m),
                l.uniform1f(this.program.u_opacity, s),
                l.uniform1f(this.program.u_debug_line, 0),
                l.uniform4fv(this.program.u_base_color, h || kc),
                l.uniform1f(this.program.u_alpha_test, this.layer.options.alphaTest || 0);
                var _ = t.glBuffer;
                !_ || _.width === n && _.height === r || (this.saveImageBuffer(_),
                delete t.glBuffer),
                t.glBuffer ? l.bindBuffer(l.ARRAY_BUFFER, _) : t.glBuffer = this.bufferTileData(0, 0, n, r),
                Dc[0] = "a_position",
                Dc[1] = 2,
                Dc[2] = t.glBuffer.type,
                this.enableVertexAttrib(Dc),
                l.bindBuffer(l.ARRAY_BUFFER, this.texBuffer),
                Dc[0] = "a_texCoord",
                Dc[1] = 2,
                Dc[2] = "UNSIGNED_BYTE",
                this.enableVertexAttrib(Dc),
                l.drawArrays(l.TRIANGLE_STRIP, 0, 4),
                a && this.drawDebug(m, 0, 0, n, r, a)
            }
            ,
            i.drawDebug = function(t, e, i, n, r, o) {
                var s = this.gl;
                s.disable(s.DEPTH_TEST),
                s.bindBuffer(s.ARRAY_BUFFER, this._debugBuffer),
                this.enableVertexAttrib(["a_position", 2, "FLOAT"]),
                s.bufferData(s.ARRAY_BUFFER, new Float32Array([e, i, e + n, i, e + n, i - r, e, i - r, e, i]), s.DYNAMIC_DRAW),
                s.uniformMatrix4fv(this.program.u_matrix, !1, t),
                s.uniform1f(this.program.u_opacity, 1),
                s.uniform1f(this.program.u_debug_line, 1),
                s.uniform4fv(this.program.u_base_color, kc),
                s.uniform1f(this.program.u_alpha_test, this.layer.options.alphaTest || 0),
                s.drawArrays(s.LINE_STRIP, 0, 5);
                var a = this._debugInfoCanvas;
                if (!a) {
                    var h = 1 < this.getMap().getDevicePixelRatio() ? 2 : 1;
                    (a = this._debugInfoCanvas = document.createElement("canvas")).width = 256 * h,
                    a.height = 32 * h;
                    var l = a.getContext("2d");
                    l.font = "20px monospace",
                    l.scale(h, h)
                }
                var u = a.getContext("2d");
                u.clearRect(0, 0, a.width, a.height);
                var c = this.layer.options.debugOutline;
                Gn.fillText(u, o, jc, c),
                this.loadTexture(a),
                s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, s.RGBA, s.UNSIGNED_BYTE, a);
                var d = e
                  , f = e + (n = 256)
                  , g = i - r + 32
                  , p = i - r;
                s.bufferData(s.ARRAY_BUFFER, this.set8(d, g, d, p, f, g, f, p), s.DYNAMIC_DRAW),
                s.uniform1f(this.program.u_debug_line, 0),
                s.bindBuffer(s.ARRAY_BUFFER, this.texBuffer),
                this.enableVertexAttrib(["a_texCoord", 2, "UNSIGNED_BYTE"]),
                s.drawArrays(s.TRIANGLE_STRIP, 0, 4),
                s.enable(s.DEPTH_TEST)
            }
            ,
            i.bufferTileData = function(t, e, i, n, r) {
                var o, s = t, a = t + i, h = e, l = e - n;
                o = c(s) && c(a) && c(h) && c(l) ? this.set8Int(s, h, s, l, a, h, a, l) : this.set8(s, h, s, l, a, h, a, l);
                var u = this.loadImageBuffer(o, r);
                return u.width = i,
                u.height = n,
                u.type = o instanceof Int16Array ? "SHORT" : "FLOAT",
                u
            }
            ,
            i.drawTinImage = function(t, e, i, n, r) {
                var o = this.gl;
                this.loadTexture(t),
                o.uniformMatrix4fv(this.program.u_matrix, !1, this.getMap().projViewMatrix),
                o.uniform1f(this.program.u_opacity, r),
                o.bindBuffer(o.ARRAY_BUFFER, this.posBuffer),
                this.enableVertexAttrib(["a_position", 3]),
                o.bufferData(o.ARRAY_BUFFER, new Float32Array(e), o.DYNAMIC_DRAW),
                o.bindBuffer(o.ARRAY_BUFFER, this.texBuffer),
                this.enableVertexAttrib(["a_texCoord", 2]),
                o.bufferData(o.ARRAY_BUFFER, new Float32Array(i), o.DYNAMIC_DRAW),
                o.bufferData(o.ELEMENT_ARRAY_BUFFER, new Uint16Array(n), o.DYNAMIC_DRAW),
                o.drawElements(o.TRIANGLES, n.length, o.UNSIGNED_SHORT, 0)
            }
            ,
            i.createCanvas2 = function() {
                this.canvas2 = Gn.createCanvas(this.canvas.width, this.canvas.height)
            }
            ,
            i.createGLContext = function() {
                this.canvas.gl && this.canvas.gl.wrap ? this.gl = this.canvas.gl.wrap() : this.gl = function(t, e) {
                    for (var i = {
                        alpha: !0,
                        stencil: !0,
                        preserveDrawingBuffer: !0,
                        antialias: !1
                    }, n = ["webgl", "experimental-webgl"], r = null, o = 0; o < n.length; ++o) {
                        try {
                            r = t.getContext(n[o], e || i)
                        } catch (t) {}
                        if (r)
                            break
                    }
                    return r
                }(this.canvas2 || this.canvas, this.layer.options.glOptions);
                var t = this.gl;
                t.clearColor(0, 0, 0, 0),
                t.enable(t.DEPTH_TEST),
                t.enable(t.STENCIL_TEST),
                t.enable(t.BLEND),
                t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA),
                this.program = this.createProgram(Oc, this.layer.options.fragmentShader || Lc),
                this._debugBuffer = this.createBuffer(),
                this.useProgram(this.program),
                this.texBuffer = this.createBuffer(),
                t.bindBuffer(t.ARRAY_BUFFER, this.texBuffer),
                this.enableVertexAttrib(["a_texCoord", 2, "UNSIGNED_BYTE"]),
                t.bufferData(t.ARRAY_BUFFER, new Uint8Array([0, 0, 0, 1, 1, 0, 1, 1]), t.STATIC_DRAW),
                this.enableSampler("u_image"),
                t.activeTexture(t.TEXTURE0),
                t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0)
            }
            ,
            i.resizeGLCanvas = function() {
                this.gl && this.gl.viewport(0, 0, this.canvas.width, this.canvas.height),
                this.canvas2 && (this.canvas2.width === this.canvas.width && this.canvas2.height === this.canvas.height || (this.canvas2.width = this.canvas.width,
                this.canvas2.height = this.canvas.height))
            }
            ,
            i.clearGLCanvas = function() {
                this.gl && (this.gl.clearStencil(255),
                this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.STENCIL_BUFFER_BIT)),
                this.gl.wrap || this.gl.clear(this.gl.DEPTH_BUFFER_BIT)
            }
            ,
            i.disposeImage = function(t) {
                t && (t.texture && this.saveTexture(t.texture),
                t.glBuffer && this.saveImageBuffer(t.glBuffer),
                delete t.texture,
                delete t.glBuffer)
            }
            ,
            i._createTexture = function(t) {
                var e = this.gl
                  , i = this.getTexture() || e.createTexture();
                e.bindTexture(e.TEXTURE_2D, i),
                e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR),
                e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR),
                e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE),
                e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE);
                var n = this.layer.options.mipmapTexture;
                return !n || Gc(t.width) && Gc(t.height) || (t = function(t) {
                    if (Gc(t.width) && Gc(t.height))
                        return t;
                    var e = t.width
                      , i = t.height;
                    Gc(e) || (e = Hc(e));
                    Gc(i) || (i = Hc(i));
                    var n = document.createElement("canvas");
                    n.width = e,
                    n.height = i;
                    var r = n.getContext("2d");
                    return r.imageSmoothingEnabled = !1,
                    r.drawImage(t, 0, 0, e, i),
                    n
                }(t)),
                e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, t),
                n && e.generateMipmap(e.TEXTURE_2D),
                i
            }
            ,
            i.getTexture = function() {
                this._textures || (this._textures = []);
                var t = this._textures;
                return t && 0 < t.length ? t.pop() : null
            }
            ,
            i.saveTexture = function(t) {
                this._textures.push(t)
            }
            ,
            i.loadTexture = function(t) {
                var e = this.getMap()
                  , i = this.gl
                  , n = t.texture;
                return n || (n = this._createTexture(t),
                t.texture = n),
                i.bindTexture(i.TEXTURE_2D, n),
                this.layer.options.mipmapTexture && (e.isMoving() && e.getRenderer().isViewChanged() ? i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.LINEAR_MIPMAP_LINEAR) : i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.LINEAR)),
                n
            }
            ,
            i.getImageBuffer = function() {
                this._imageBuffers || (this._imageBuffers = []);
                var t = this._imageBuffers;
                return t && 0 < t.length ? t.pop() : null
            }
            ,
            i.saveImageBuffer = function(t) {
                this._imageBuffers || (this._imageBuffers = []),
                this._imageBuffers.push(t)
            }
            ,
            i.loadImageBuffer = function(t, e) {
                var i = this.gl
                  , n = e || this.createImageBuffer();
                return i.bindBuffer(i.ARRAY_BUFFER, n),
                i.bufferData(i.ARRAY_BUFFER, t, i.STATIC_DRAW),
                n
            }
            ,
            i.createImageBuffer = function() {
                return this.getImageBuffer() || this.createBuffer()
            }
            ,
            i.removeGLCanvas = function() {
                var e = this.gl;
                if (e) {
                    if (this._debugBuffer && (e.deleteBuffer(this._debugBuffer),
                    delete this._debugBuffer),
                    this._buffers && (this._buffers.forEach(function(t) {
                        e.deleteBuffer(t)
                    }),
                    delete this._buffers),
                    this._textures && (this._textures.forEach(function(t) {
                        return e.deleteTexture(t)
                    }),
                    delete this._textures),
                    this._debugInfoCanvas) {
                        var t = this._debugInfoCanvas.texture;
                        t && e.deleteTexture(t),
                        delete this._debugInfoCanvas.texture,
                        delete this._debugInfoCanvas
                    }
                    var i = e.program;
                    e.deleteShader(i.fragmentShader),
                    e.deleteShader(i.vertexShader),
                    e.deleteProgram(i),
                    delete this.gl,
                    delete this.canvas2
                }
            }
            ,
            i.createBuffer = function() {
                var t = this.gl.createBuffer();
                if (!t)
                    throw new Error("Failed to create the buffer object");
                return this._buffers || (this._buffers = []),
                this._buffers.push(t),
                t
            }
            ,
            i.enableVertexAttrib = function(t) {
                Rc(this.gl, this.gl.program, t)
            }
            ,
            i.createProgram = function(t, e) {
                for (var i = this.gl, n = Ec(i, t, e), r = n.program, o = n.vertexShader, s = n.fragmentShader, a = i.getProgramParameter(r, 35718), h = [], l = 0; l < a; ++l) {
                    var u = i.getActiveUniform(r, l);
                    h.push(u.name)
                }
                return r.vertexShader = o,
                r.fragmentShader = s,
                this._initUniforms(r, h),
                r
            }
            ,
            i.useProgram = function(t) {
                var e = this.gl;
                return e.useProgram(t),
                e.program = t,
                this
            }
            ,
            i.enableSampler = function(t, e) {
                var i = this.gl
                  , n = this._getUniform(i.program, t);
                return e || (e = 0),
                i.uniform1i(n, e),
                n
            }
            ,
            i._initUniforms = function(t, e) {
                for (var i = 0; i < e.length; i++) {
                    var n = e[i]
                      , r = e[i]
                      , o = n.indexOf("[");
                    0 <= o && (n = n.substring(0, o),
                    f || (r = r.substring(0, o))),
                    t[n] = this._getUniform(t, r)
                }
            }
            ,
            i._getUniform = function(t, e) {
                var i = this.gl.getUniformLocation(t, e);
                if (!i)
                    throw new Error("Failed to get the storage location of " + e);
                return i
            }
            ,
            e
        }(t);
        return F(e.prototype, {
            set8: (l = $.ie9 ? null : new Float32Array(8),
            function(t, e, i, n, r, o, s, a) {
                return l[0] = t,
                l[1] = e,
                l[2] = i,
                l[3] = n,
                l[4] = r,
                l[5] = o,
                l[6] = s,
                l[7] = a,
                l
            }
            ),
            set8Int: (h = $.ie9 ? null : new Int16Array(8),
            function(t, e, i, n, r, o, s, a) {
                return h[0] = t,
                h[1] = e,
                h[2] = i,
                h[3] = n,
                h[4] = r,
                h[5] = o,
                h[6] = s,
                h[7] = a,
                h
            }
            )
        }),
        e
    };
    function Gc(t) {
        return 0 == (t & t - 1) && 0 !== t
    }
    function Hc(t) {
        return Math.pow(2, Math.ceil(Math.log(t) / Math.LN2))
    }
    var Bc = {
        renderer: $.webgl ? "gl" : "canvas",
        crossOrigin: null,
        alphaTest: 0,
        depthMask: !0,
        depthFunc: "<="
    }
      , Nc = new dt(0,0)
      , Zc = function(r) {
        function t(t, e, i) {
            var n;
            return !e || Array.isArray(e) || e.url || (i = e,
            e = null),
            (n = r.call(this, t, i) || this)._images = e,
            n
        }
        it(t, r);
        var e = t.prototype;
        return e.onAdd = function() {
            this._prepareImages(this._images)
        }
        ,
        e.setImages = function(t) {
            return this._images = t,
            this._prepareImages(t),
            this
        }
        ,
        e.getImages = function() {
            return this._images
        }
        ,
        e._prepareImages = function(t) {
            t = t || [],
            Array.isArray(t) || (t = [t]);
            var i = this.getMap()
              , n = i.getGLRes();
            this._imageData = t.map(function(t) {
                var e = new Zr(t.extent);
                return F({}, t, {
                    extent: e,
                    extent2d: e.convertTo(function(t) {
                        return i.coordToPointAtRes(t, n)
                    })
                })
            }),
            this._images = t;
            var e = this.getRenderer();
            e && e.refreshImages()
        }
        ,
        t
    }(ca);
    Zc.mergeOptions(Bc);
    var Wc = []
      , Vc = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.isDrawable = function() {
            return !this.getMap().getPitch() || (console && console.warn("ImageLayer with canvas renderer can't be pitched, use gl renderer ('renderer' : 'gl') instead."),
            !1)
        }
        ,
        i.checkResources = function() {
            var i = this;
            if (this._imageLoaded)
                return Wc;
            var t = this.layer._imageData.map(function(t) {
                return [t.url, null, null]
            });
            if (this.resources) {
                var n = []
                  , r = new zo;
                t.forEach(function(t) {
                    if (i.resources.isResourceLoaded(t)) {
                        var e = i.resources.getImage(t);
                        r.addResource(t, e)
                    } else
                        n.push(t)
                }),
                this.resources.forEach(function(t, e) {
                    r.isResourceLoaded(t) || i.retireImage(e.image)
                }),
                this.resources = r,
                t = n
            }
            return this._imageLoaded = !0,
            t
        }
        ,
        i.retireImage = function(t) {
            t.close && t.close()
        }
        ,
        i.refreshImages = function() {
            this._imageLoaded = !1,
            this.setToRedraw()
        }
        ,
        i.draw = function(t, e) {
            this.isDrawable() && (this.prepareCanvas(),
            this._painted = !1,
            this._drawImages(t, e),
            this.completeRender())
        }
        ,
        i._drawImages = function() {
            var t = this.layer._imageData
              , e = this.getMap()
              , i = e._get2DExtentAtRes(e.getGLRes());
            if (t && t.length)
                for (var n = 0; n < t.length; n++) {
                    var r = t[n].extent2d
                      , o = this.resources && this.resources.getImage(t[n].url);
                    o && i.intersects(r) && (this._painted = !0,
                    this._drawImage(o, r, t[n].opacity || 1))
                }
        }
        ,
        i._drawImage = function(t, e, i) {
            var n = 0
              , r = this.context;
            i < 1 && (n = r.globalAlpha,
            r.globalAlpha = i);
            var o = this.getMap()
              , s = Nc.set(e.xmin, e.ymax)
              , a = o._pointAtResToContainerPoint(s, o.getGLRes())
              , h = a.x
              , l = a.y
              , u = o.getBearing();
            u && (r.save(),
            r.translate(h, l),
            u && r.rotate(-u * Math.PI / 180),
            h = l = 0);
            var c = o.getGLScale();
            r.drawImage(t, h, l, e.getWidth() / c, e.getHeight() / c),
            u && r.restore(),
            n && (r.globalAlpha = n)
        }
        ,
        i.drawOnInteracting = function() {
            this.draw()
        }
        ,
        e
    }(Io)
      , Uc = function(o) {
        function t() {
            return o.apply(this, arguments) || this
        }
        it(t, o);
        var e = t.prototype;
        return e.drawOnInteracting = function(t, e, i) {
            this.draw(e, i)
        }
        ,
        e._prepareGLContext = function() {
            var t, e = this.gl;
            if (e) {
                e.disable(e.STENCIL_TEST),
                e.disable(e.POLYGON_OFFSET_FILL),
                e.enable(e.DEPTH_TEST),
                e.enable(e.BLEND),
                e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA),
                e.depthFunc((t = this.layer.options.depthFunc,
                Ac[t]));
                var i = !!this.layer.options.depthMask;
                e.depthMask(i)
            }
        }
        ,
        e._drawImages = function(t, e) {
            var i = this.gl;
            if (e && e.renderTarget) {
                var n = e.renderTarget.fbo;
                if (n) {
                    var r = e.renderTarget.getFramebuffer(n);
                    i.bindFramebuffer(i.FRAMEBUFFER, r)
                }
            }
            (this._prepareGLContext(),
            o.prototype._drawImages.call(this),
            e && e.renderTarget) && (e.renderTarget.fbo && i.bindFramebuffer(i.FRAMEBUFFER, null))
        }
        ,
        e.isDrawable = function() {
            return !0
        }
        ,
        e._drawImage = function(t, e, i) {
            this.drawGLImage(t, e.xmin, e.ymax, e.getWidth(), e.getHeight(), 1, i)
        }
        ,
        e.createContext = function() {
            this.createGLContext()
        }
        ,
        e.resizeCanvas = function(t) {
            this.canvas && (o.prototype.resizeCanvas.call(this, t),
            this.resizeGLCanvas())
        }
        ,
        e.clearCanvas = function() {
            this.canvas && (o.prototype.clearCanvas.call(this),
            this.clearGLCanvas())
        }
        ,
        e.retireImage = function(t) {
            t.close && t.close(),
            this.disposeImage(t)
        }
        ,
        e.onRemove = function() {
            this.removeGLCanvas(),
            o.prototype.onRemove.call(this)
        }
        ,
        t
    }(Fc(Vc));
    Zc.registerRenderer("canvas", Vc),
    Zc.registerRenderer("gl", Uc);
    var Jc = function(r) {
        function t() {
            return r.apply(this, arguments) || this
        }
        it(t, r);
        var e = t.prototype;
        return e.getPrepareParams = function() {
            return []
        }
        ,
        e.getDrawParams = function() {
            return []
        }
        ,
        e.onCanvasCreate = function() {
            this.canvas && this.layer.options.doubleBuffer && (this.buffer = Gn.createCanvas(this.canvas.width, this.canvas.height, this.getMap().CanvasClass))
        }
        ,
        e.needToRedraw = function() {
            return !!this.layer.options.animation || !(this.getMap().isInteracting() && !this.layer.drawOnInteracting) && r.prototype.needToRedraw.call(this)
        }
        ,
        e.draw = function() {
            this.prepareCanvas(),
            this.prepareDrawContext(),
            this._drawLayer.apply(this, arguments)
        }
        ,
        e.drawOnInteracting = function() {
            this._drawLayerOnInteracting.apply(this, arguments)
        }
        ,
        e.getCanvasImage = function() {
            var t = r.prototype.getCanvasImage.call(this);
            if (t && t.image && this.layer.options.doubleBuffer) {
                var e = t.image;
                this.buffer.width === e.width && this.buffer.height === e.height || (this.buffer.width = e.width,
                this.buffer.height = e.height);
                var i = this.buffer.getContext("2d")
                  , n = this.layer.doubleBuffer(i, this.context);
                (void 0 === n || n) && (Gn.image(i, e, 0, 0),
                t.image = this.buffer)
            }
            return t
        }
        ,
        e.remove = function() {
            return delete this._drawContext,
            r.prototype.remove.call(this)
        }
        ,
        e.onZoomStart = function(t) {
            this.layer.onZoomStart(t),
            r.prototype.onZoomStart.call(this, t)
        }
        ,
        e.onZooming = function(t) {
            this.layer.onZooming(t),
            r.prototype.onZooming.call(this, t)
        }
        ,
        e.onZoomEnd = function(t) {
            this.layer.onZoomEnd(t),
            r.prototype.onZoomEnd.call(this, t)
        }
        ,
        e.onMoveStart = function(t) {
            this.layer.onMoveStart(t),
            r.prototype.onMoveStart.call(this, t)
        }
        ,
        e.onMoving = function(t) {
            this.layer.onMoving(t),
            r.prototype.onMoving.call(this, t)
        }
        ,
        e.onMoveEnd = function(t) {
            this.layer.onMoveEnd(t),
            r.prototype.onMoveEnd.call(this, t)
        }
        ,
        e.onResize = function(t) {
            this.layer.onResize(t),
            r.prototype.onResize.call(this, t)
        }
        ,
        e.prepareDrawContext = function() {
            if (!this._predrawed) {
                var t = qc(this.getPrepareParams());
                this._drawContext = this.layer.prepareToDraw.apply(this.layer, [this.context].concat(t)),
                this._drawContext || (this._drawContext = []),
                Array.isArray(this._drawContext) || (this._drawContext = [this._drawContext]),
                this._predrawed = !0
            }
        }
        ,
        e._prepareDrawParams = function() {
            if (!this.getMap())
                return null;
            var t = this.getViewExtent();
            if (t.maskExtent && !t.extent.intersects(t.maskExtent))
                return this.completeRender(),
                null;
            var e = [this.context, t]
              , i = qc(this.getDrawParams());
            return e.push.apply(e, i),
            e.push.apply(e, this._drawContext),
            e
        }
        ,
        e._drawLayer = function() {
            var t = this._prepareDrawParams();
            if (t) {
                for (var e = arguments.length, i = new Array(e), n = 0; n < e; n++)
                    i[n] = arguments[n];
                this.layer.draw.apply(this.layer, t.concat(i)),
                this.completeRender()
            }
        }
        ,
        e._drawLayerOnInteracting = function() {
            if (this.layer.drawOnInteracting) {
                var t = this._prepareDrawParams();
                if (t) {
                    for (var e = arguments.length, i = new Array(e), n = 0; n < e; n++)
                        i[n] = arguments[n];
                    this.layer.drawOnInteracting.apply(this.layer, t.concat(i)),
                    this.completeRender()
                }
            }
        }
        ,
        t
    }(Io);
    function qc(t) {
        return t || (t = []),
        Array.isArray(t) || (t = [t]),
        t
    }
    var Xc = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.isCanvasRender = function() {
            return !0
        }
        ,
        i.prepareToDraw = function() {}
        ,
        i.draw = function() {}
        ,
        i.redraw = function() {
            return this._getRenderer() && this._getRenderer().setToRedraw(),
            this
        }
        ,
        i.play = function() {
            return this.config("animation", !0),
            this
        }
        ,
        i.pause = function() {
            return this.config("animation", !1),
            this
        }
        ,
        i.isPlaying = function() {
            return this.options.animation
        }
        ,
        i.clearCanvas = function() {
            return this._getRenderer() && this._getRenderer().clearCanvas(),
            this
        }
        ,
        i.requestMapToRender = function() {
            return this._getRenderer() && this._getRenderer().requestMapToRender(),
            this
        }
        ,
        i.completeRender = function() {
            return this._getRenderer() && this._getRenderer().completeRender(),
            this
        }
        ,
        i.onCanvasCreate = function() {
            return this
        }
        ,
        i.onZoomStart = function() {}
        ,
        i.onZooming = function() {}
        ,
        i.onZoomEnd = function() {}
        ,
        i.onMoveStart = function() {}
        ,
        i.onMoving = function() {}
        ,
        i.onMoveEnd = function() {}
        ,
        i.onResize = function() {}
        ,
        i.doubleBuffer = function(t) {
            return t.clearRect(0, 0, t.canvas.width, t.canvas.height),
            this
        }
        ,
        e
    }(ca);
    Xc.mergeOptions({
        doubleBuffer: !1,
        animation: !1
    }),
    Xc.registerRenderer("canvas", Jc);
    var Yc = new dt(0,0)
      , Qc = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.getParticles = function() {}
        ,
        i.draw = function(t, e) {
            var i = this.getParticles(x());
            if (i && 0 !== i.length) {
                var n = this.getMap()
                  , r = e.extent;
                e.maskExtent && (r = e.extent.intersection(e.maskExtent)),
                r = r.convertTo(function(t) {
                    return n._pointToContainerPoint(t, void 0, 0, Yc)
                });
                for (var o = 2 * Math.PI, s = 0, a = i.length; s < a; s++) {
                    var h = i[s].point;
                    if (r.contains(h)) {
                        var l = i[s].color || this.options.lineColor || "#fff"
                          , u = i[s].r;
                        t.fillStyle !== l && (t.fillStyle = l),
                        u <= 2 ? t.fillRect(h.x - u / 2, h.y - u / 2, u, u) : (t.beginPath(),
                        t.arc(h.x, h.y, u / 2, 0, o),
                        t.fill())
                    }
                }
                this._fillCanvas(t)
            } else {
                this._getRenderer() && (this._getRenderer()._shouldClear = !0)
            }
        }
        ,
        i._fillCanvas = function(t) {
            var e = t.globalCompositeOperation;
            t.globalCompositeOperation = "destination-out";
            var i = this.options.trail || 30;
            t.fillStyle = "rgba(0, 0, 0, " + 1 / i + ")",
            t.fillRect(0, 0, t.canvas.width, t.canvas.height),
            t.globalCompositeOperation = e
        }
        ,
        e
    }(Xc);
    Qc.mergeOptions({
        animation: !0
    }),
    Qc.registerRenderer("canvas", function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.draw = function() {
            this.canvas && this.layer.options.animation && !this._shouldClear || (this.prepareCanvas(),
            this._shouldClear = !1),
            this.prepareDrawContext(),
            this._drawLayer()
        }
        ,
        i.drawOnInteracting = function() {
            this.draw(),
            this._shouldClear = !1
        }
        ,
        i.onSkipDrawOnInteracting = function() {
            this._shouldClear = !0
        }
        ,
        e
    }(Jc));
    var Kc, $c, td = new zo, ed = function(s) {
        function t(t, e, i) {
            var n;
            ((n = s.call(this, i) || this).target = t).once("remove", n.delete, at(at(n)));
            var r = n.options.symbol
              , o = r.markerLineWidth || 1;
            return n.w = r.markerWidth + o,
            n.h = r.markerHeight + o,
            n.opacity = ut(r.opacity) ? 1 : r.opacity,
            n.map = e,
            n.events = i.events,
            n._fetchImage(),
            n.addTo(e),
            n
        }
        it(t, s);
        var e = t.prototype;
        return e.getCursor = function() {
            return this.options.cursor || "default"
        }
        ,
        e._fetchImage = function() {
            var e = this.map
              , t = this.options.symbol
              , i = t.markerFile;
            this.url = i || $e(t);
            var n = td.getImage(this.url);
            if (!n) {
                var r = this.w
                  , o = this.h;
                if (i)
                    (n = new Image).onload = function() {
                        var t = e.getRenderer();
                        t && t.setToRedraw()
                    }
                    ,
                    n.src = this.url;
                else {
                    var s = document.createElement("canvas");
                    s.width = r,
                    s.height = o,
                    n = _s(s.getContext("2d"), {
                        x: r / 2,
                        y: o / 2
                    }, t, td)
                }
                td.addResource([this.url, r, o], n)
            }
            td.login(this.url),
            this._img = n
        }
        ,
        e.setContainerPoint = function(t) {
            this._point = t,
            this._point._sub(this.w / 2, this.h / 2)
        }
        ,
        e.getContainerPoint = function() {
            return this._point.add(this.w / 2, this.h / 2)
        }
        ,
        e.offset = function(t) {
            this._point._add(t)
        }
        ,
        e.render = function(t) {
            if (!this._img)
                return !1;
            var e = this.options.symbol
              , i = e.markerDx || 0
              , n = e.markerDy || 0
              , r = this.map
              , o = this._point
              , s = o.x
              , a = o.y
              , h = this.w
              , l = this.h;
            if (0 < s + h && s < r.width && 0 < a + l && a < r.height) {
                var u = r.getDevicePixelRatio();
                return t.globalAlpha = this.opacity,
                t.drawImage(this._img, Math.round((s + i) * u), Math.round((a + n) * u), Math.round(h * u), Math.round(l * u)),
                !0
            }
            return !1
        }
        ,
        e.delete = function() {
            if (this.map) {
                var t = this.map.getRenderer();
                t && t.removeTopElement(this)
            }
            td.logout(this.url),
            this._dragger && (this._dragger.disable(),
            delete this._dragger),
            delete this.map
        }
        ,
        e.hitTest = function(t) {
            var e = this.options.symbol
              , i = e.markerDx || 0
              , n = e.markerDy || 0
              , r = this.w
              , o = this.h
              , s = this._point.x + i
              , a = this._point.y + n;
            return t.x >= s && t.x <= s + r && t.y >= a && t.y <= a + o
        }
        ,
        e.addTo = function(t) {
            (this.map = t).getRenderer().addTopElement(this)
        }
        ,
        e.onEvent = function(t) {
            this.fire(t.type, t)
        }
        ,
        e.mousedown = function(t) {
            var e = t.target
              , i = this.options.cursor;
            i && e.setCursor(i),
            this.onDragstart(t)
        }
        ,
        e.onDragstart = function(t) {
            var e = t.containerPoint
              , i = t.target
              , n = i._panels.mapWrapper || i._containerDOM
              , r = this._dragger = new Er(n);
            r.on("dragging", this.onDragging, this).on("mouseup", this.onDragend, this).enable(),
            r.type = "handle",
            r.onMouseDown(t.domEvent),
            Kc = e.x,
            $c = e.y,
            this.fire("dragstart", {
                containerPoint: e
            })
        }
        ,
        e.onDragging = function(t) {
            if (this._dragger) {
                var e = this.map
                  , i = Mi(t.domEvent, e._containerDOM)
                  , n = {
                    x: i.x - Kc,
                    y: i.y - $c
                }
                  , r = e.containerPointToCoord(new dt(Kc,$c))
                  , o = e.containerPointToCoord(i);
                Kc = i.x,
                $c = i.y,
                this.offset(n),
                this.fire("dragging", {
                    containerPoint: i,
                    coordOffset: o._sub(r)
                })
            }
        }
        ,
        e.onDragend = function(t) {
            if (this._dragger) {
                var e = this.map;
                e.resetCursor();
                var i = Mi(t.domEvent, e._containerDOM)
                  , n = {
                    x: i.x - Kc,
                    y: i.y - $c
                };
                this.offset(n),
                this._dragger.disable(),
                delete this._dragger,
                this.fire("dragend", {
                    containerPoint: i
                })
            }
        }
        ,
        e.needCollision = function() {
            var t = this.target;
            return t && t.options && t.options.collision
        }
        ,
        e.getRenderBBOX = function(t) {
            var e = this.target
              , i = this.map;
            if (!e || !e.options || !i)
                return null;
            var n = this.options.symbol
              , r = n.markerDx || 0
              , o = n.markerDy || 0
              , s = this._point
              , a = s.x
              , h = s.y
              , l = this.w
              , u = this.h;
            t = t || i.getDevicePixelRatio(),
            this.bbox = this.bbox || Rn();
            var c = Math.round((a + r) * t)
              , d = Math.round((h + o) * t)
              , f = Math.round(l * t)
              , g = Math.round(u * t);
            this.bbox[0] = c,
            this.bbox[1] = d,
            this.bbox[2] = c + f,
            this.bbox[3] = d + g;
            var p = e.options.collisionBufferSize || 0;
            return In(this.bbox, p),
            this.bbox
        }
        ,
        t
    }(Un(qn)), id = function() {
        function t(t, e) {
            (this.target = t).once("remove", this.delete, this),
            this.map = e,
            this.addTo(e)
        }
        var e = t.prototype;
        return e.setPoints = function(t) {
            var e = (this.points = t).map(function(t) {
                return t.x
            })
              , i = t.map(function(t) {
                return t.y
            });
            this.xmin = Math.min.apply(Math, e),
            this.xmax = Math.max.apply(Math, e),
            this.ymin = Math.min.apply(Math, i),
            this.ymax = Math.max.apply(Math, i)
        }
        ,
        e.hitTest = function() {
            return !1
        }
        ,
        e.render = function(t) {
            var e = this.map;
            if (!(this.xmax <= 0 || this.xmin >= e.width || this.ymax <= 0 || this.ymin >= e.height)) {
                var i = e.getDevicePixelRatio()
                  , n = .5;
                t.lineWidth = 1,
                t.strokeStyle = "#000",
                t.globalAlpha = 1,
                t.beginPath();
                var r = this.points;
                t.moveTo(s(r[0].x), s(r[0].y));
                for (var o = 1; o < this.points.length; o++)
                    t.lineTo(s(r[o].x), s(r[o].y));
                t.closePath(),
                t.stroke()
            }
            function s(t) {
                return Math.round(t) * i + n
            }
        }
        ,
        e.addTo = function(t) {
            (this.map = t).getRenderer().addTopElement(this)
        }
        ,
        e.delete = function() {
            if (this.map) {
                var t = this.map.getRenderer();
                t && t.removeTopElement(this)
            }
        }
        ,
        t
    }();
    function nd(t, e) {
        return {
            markerType: t,
            markerFill: "#fff",
            markerLineColor: "#000",
            markerLineWidth: 2,
            markerWidth: 10,
            markerHeight: 10,
            opacity: e
        }
    }
    var rd = {
        fixAspectRatio: !1,
        symbol: null,
        removeVertexOn: "contextmenu",
        centerHandleSymbol: nd("ellipse", 1),
        vertexHandleSymbol: nd("square", 1),
        newVertexHandleSymbol: nd("square", .4),
        collision: !1,
        collisionBufferSize: 0
    }
      , od = function(n) {
        function t(t, e) {
            var i;
            return (i = n.call(this, e) || this)._geometry = t,
            i._geometry ? i : at(i)
        }
        it(t, n);
        var e = t.prototype;
        return e.getMap = function() {
            return this._geometry.getMap()
        }
        ,
        e.prepare = function() {
            var t = this.getMap();
            t && (t.on("drawtopstart", this._refresh, this),
            this.options.symbol && (this._originalSymbol = this._geometry.getSymbol(),
            this._geometry.setSymbol(this.options.symbol)),
            this._prepareEditStageLayer())
        }
        ,
        e._prepareEditStageLayer = function() {
            var t = this._geometry.getLayer();
            if ("canvas" === t.options.renderer) {
                var e = this.getMap()
                  , i = "_maptalks__internal_layer__edit_stage_" + mt() + "_shadow";
                if (this._shadowLayer = e.getLayer(i),
                !this._shadowLayer) {
                    var n = t.constructor;
                    this._shadowLayer = new n(i),
                    e.addLayer(this._shadowLayer)
                }
            }
        }
        ,
        e.start = function() {
            if (this._geometry && this._geometry.getMap() && !this._geometry.editing) {
                this.editing = !0,
                this.prepare();
                var t, e = this._geometry, i = "canvas" === this._geometry.getLayer().options.renderer;
                this._geometryDraggble = e.options.draggable,
                i ? (e.config("draggable", !1),
                (t = e.copy()).setSymbol(e._getInternalSymbol()),
                t.copyEventListeners(e),
                e._getParent() && t.copyEventListeners(e._getParent()),
                t._setEventTarget(e),
                t.setId(null).config({
                    draggable: !1
                }),
                this._shadow = t,
                e.hide()) : e instanceof Ch && e.config("draggable", !0),
                this._switchGeometryEvents("on"),
                (e instanceof Ch || e instanceof Fh || e instanceof Hh || e instanceof Gh) && this._createOrRefreshOutline(),
                this._shadowLayer && this._shadowLayer.bringToFront().addGeometry(t),
                e instanceof Ch ? t && (t.config("draggable", !0),
                t.on("dragend", this._onMarkerDragEnd, this)) : this._createCenterHandle(),
                e instanceof Ch && !1 !== this.options.resize ? this.createMarkerEditor() : e instanceof Fh ? this.createCircleEditor() : e instanceof Hh ? this.createEllipseOrRectEditor() : e instanceof Gh ? this.createEllipseOrRectEditor() : e instanceof Bh || (e instanceof yh || e instanceof Ph) && this.createPolygonEditor()
            }
        }
        ,
        e.stop = function() {
            delete this._history,
            delete this._historyPointer,
            delete this._editOutline,
            this._switchGeometryEvents("off"),
            this.getMap() && (this._geometry.config("draggable", this._geometryDraggble),
            this._shadow && (delete this._shadow,
            delete this._geometryDraggble,
            this._geometry.show()),
            this._shadowLayer && (this._shadowLayer.remove(),
            delete this._shadowLayer),
            this._refreshHooks = [],
            this.options.symbol && (this._geometry.setSymbol(this._originalSymbol),
            delete this._originalSymbol),
            this.editing = !1),
            this.fire("remove")
        }
        ,
        e.isEditing = function() {
            return !ut(this.editing) && this.editing
        }
        ,
        e._getGeometryEvents = function() {
            return {
                symbolchange: this._onGeoSymbolChange,
                dragstart: this._onDragStart,
                dragend: this._onDragEnd,
                "positionchange shapechange": this._exeAndReset
            }
        }
        ,
        e._switchGeometryEvents = function(t) {
            if (this._geometry) {
                var e = this._getGeometryEvents();
                for (var i in e)
                    this._geometry[t](i, e[i], this)
            }
        }
        ,
        e._onGeoSymbolChange = function(t) {
            this._shadow && this._shadow.setSymbol(t.target._getInternalSymbol())
        }
        ,
        e._onMarkerDragEnd = function() {
            this._update("setCoordinates", this._shadow.getCoordinates().toArray())
        }
        ,
        e._createOrRefreshOutline = function() {
            var t = this._geometry
              , e = this._editOutline;
            e || (this._editOutline = new id(this,this.getMap()),
            this._addRefreshHook(this._createOrRefreshOutline));
            var i = this._editOutline.points;
            if (t instanceof Ch)
                this._editOutline.setPoints(t.getContainerExtent().toArray(i));
            else {
                var n = this.getMap();
                (i = t._getPrjExtent().toArray(i)).forEach(function(t) {
                    return n._prjToContainerPoint(t, null, t)
                }),
                this._editOutline.setPoints(i)
            }
            return e
        }
        ,
        e._createCenterHandle = function() {
            var n, r = this, e = this.getMap(), t = this.options.centerHandleSymbol, i = e.coordToContainerPoint(this._geometry.getCenter()), o = this.createHandle(i, {
                symbol: t,
                cursor: "move",
                onDown: function() {
                    if (r._shadow) {
                        var t = ti((n = r._shadow.copy())._getInternalSymbol(), .5);
                        n.setSymbol(t).addTo(r._geometry.getLayer())
                    }
                },
                onMove: function(t) {
                    var e = t.coordOffset;
                    n ? n.translate(e) : r._geometry.translate(e)
                },
                onUp: function() {
                    if (n) {
                        var t = n.getFirstCoordinate()
                          , e = r._geometry.getFirstCoordinate()
                          , i = t.sub(e);
                        r._update("translate", i),
                        n.remove()
                    }
                }
            });
            this._addRefreshHook(function() {
                var t = r._geometry.getCenter();
                o.setContainerPoint(e.coordToContainerPoint(t))
            })
        }
        ,
        e._createHandleInstance = function(t, e) {
            var i = this.getMap()
              , n = se(e.symbol, function() {
                return [i.getZoom(), {
                    "{bearing}": i.getBearing(),
                    "{pitch}": i.getPitch(),
                    "{zoom}": i.getZoom()
                }]
            })
              , r = this.options.removeVertexOn
              , o = new ed(this,i,{
                symbol: n,
                cursor: e.cursor,
                events: r
            });
            return o.setContainerPoint(t),
            o
        }
        ,
        e.createHandle = function(t, e) {
            e || (e = {});
            var i = this._createHandleInstance(t, e)
              , n = this;
            return i.on("dragstart", function(t) {
                return this._updating = !0,
                e.onDown && (e.onDown.call(n, t.containerPoint, t),
                this._geometry.fire("handledragstart")),
                !1
            }, this),
            i.on("dragging", function(t) {
                return n._hideContext(),
                e.onMove && (e.onMove.call(n, t),
                this._geometry.fire("handledragging")),
                !1
            }, this),
            i.on("dragend", function(t) {
                return e.onUp && (e.onUp.call(n, t),
                this._geometry.fire("handledragend")),
                this._updating = !1
            }, this),
            e.onRefresh && (i.refresh = e.onRefresh),
            i
        }
        ,
        e._createResizeHandles = function(s, a, h) {
            var l = this
              , u = ["nw-resize", "n-resize", "ne-resize", "w-resize", "e-resize", "sw-resize", "s-resize", "se-resize"]
              , c = [null, "y", null, "x", "x", null, "y", null]
              , d = this._geometry
              , f = d instanceof Ch;
            s || (s = []);
            var g = this
              , p = []
              , m = {}
              , _ = this.getMap()
              , v = this.options.vertexHandleSymbol
              , t = function() {
                for (var o = function() {
                    if (f) {
                        var t = d.getContainerExtent();
                        return [new dt(t.xmin,t.ymin), new dt((t.xmax + t.xmin) / 2,t.ymin), new dt(t.xmax,t.ymin), new dt(t.xmin,(t.ymin + t.ymax) / 2), new dt(t.xmax,(t.ymin + t.ymax) / 2), new dt(t.xmin,t.ymax), new dt((t.xmax + t.xmin) / 2,t.ymax), new dt(t.xmax,t.ymax)]
                    }
                    var e = d._getPrjExtent();
                    return [new dt(e.xmin,e.ymax), new dt((e.xmax + e.xmin) / 2,e.ymax), new dt(e.xmax,e.ymax), new dt(e.xmin,(e.ymax + e.ymin) / 2), new dt(e.xmax,(e.ymax + e.ymin) / 2), new dt(e.xmin,e.ymin), new dt((e.xmax + e.xmin) / 2,e.ymin), new dt(e.xmax,e.ymin)]
                }(), t = function(e) {
                    if (Array.isArray(s) && s.some(function(t) {
                        return t === e
                    }))
                        return "continue";
                    var i, t = o[e], n = f ? t : _._prjToContainerPoint(t);
                    if (p.length < o.length - s.length) {
                        var r = l.createHandle(n, {
                            symbol: v,
                            cursor: u[e],
                            axis: c[e],
                            onMove: (i = e,
                            function(t) {
                                g._updating = !0,
                                a(t.containerPoint, i),
                                d.fire("resizing")
                            }
                            ),
                            onUp: function() {
                                g._updating = !1,
                                h()
                            }
                        });
                        m[e] = p.length,
                        p.push(r)
                    } else
                        p[m[e]].setContainerPoint(n)
                }, e = 0; e < o.length; e++)
                    t(e)
            };
            return t(),
            this._addRefreshHook(t),
            p
        }
        ,
        e.createMarkerEditor = function() {
            var d = this
              , f = this._shadow || this._geometry
              , g = this.getMap();
            if (f._canEdit()) {
                this._history || this._recordHistory(n());
                var t = f._getInternalSymbol()
                  , p = new dt(0,0);
                G(t.markerDx) && (p.x = t.markerDx),
                G(t.markerDy) && (p.y = t.markerDy);
                var m = null
                  , _ = "middle"
                  , v = "middle";
                if (Fs.test(t)) {
                    var e = t.markerType;
                    "pin" === e || "pie" === e || "bar" === e ? (m = [5, 6, 7],
                    _ = "bottom") : "rectangle" === e && (m = [0, 1, 2, 3, 5],
                    _ = "top",
                    v = "left")
                } else
                    (Es.test(t) || Gs.test(t)) && (_ = "bottom",
                    m = [5, 6, 7]);
                var y, x = [2, 1, 2, 0, 0, 2, 1, 2];
                if (this.options.fixAspectRatio) {
                    var i = f.getSize();
                    y = i.width / i.height
                }
                var w = this._createResizeHandles(m, function(t, e) {
                    if (m && 0 <= m.indexOf(e)) {
                        var i = g.containerPointToCoordinate(t.sub(p))
                          , n = f.getCoordinates();
                        i.x = n.x,
                        f.setCoordinates(i),
                        d._updateCoordFromShadow(!0),
                        t = w[w.length - 1 - e].getContainerPoint()
                    }
                    var r = g.coordToContainerPoint(f.getCoordinates()).add(p)
                      , o = f._getInternalSymbol()
                      , s = t.sub(r);
                    "bottom" === _ && t.y > r.y && (s.y = 0);
                    var a = "middle" === _ ? 2 : 1
                      , h = "left" === v ? 1 : 2
                      , l = Math.abs(s.x) * h
                      , u = Math.abs(s.y) * a;
                    y && (u = (l = Math.max(l, u * y)) / y);
                    var c = x[e];
                    f instanceof Xh ? ((y || 0 === c || 2 === c) && (f.setWidth(l),
                    f !== d._geometry && d._geometry.setWidth(l)),
                    (y || 1 === c || 2 === c) && (f.setHeight(u),
                    f !== d._geometry && d._geometry.setHeight(u))) : ((y || 0 === c || 2 === c) && (o.markerWidth = Math.min(l, d._geometry.options.maxMarkerWidth || 1 / 0)),
                    (y || 1 === c || 2 === c) && (o.markerHeight = Math.min(u, d._geometry.options.maxMarkerHeight || 1 / 0)),
                    f.setSymbol(o),
                    f !== d._geometry && d._geometry.setSymbol(o))
                }, function() {
                    d._update(n())
                })
            } else
                console && console.warn("A marker can't be resized with symbol:", f.getSymbol());
            function n() {
                var t = [["setCoordinates", f.getCoordinates().toArray()]];
                return f instanceof Xh ? (t.push(["setWidth", f.getWidth()]),
                t.push(["setHeight", f.getHeight()])) : t.push(["setSymbol", f.getSymbol()]),
                t
            }
        }
        ,
        e.createCircleEditor = function() {
            var s = this
              , a = this._shadow || this._geometry
              , h = this.getMap();
            this._history || this._recordHistory([["setCoordinates", a.getCoordinates().toArray()], ["setRadius", a.getRadius()]]),
            this._createResizeHandles(null, function(t) {
                var e = a.getCenter()
                  , i = h.containerPointToCoord(t)
                  , n = new Ph([[e.x, e.y], [i.x, e.y]])
                  , r = new Ph([[e.x, e.y], [e.x, i.y]])
                  , o = Math.max(h.computeGeometryLength(n), h.computeGeometryLength(r));
                a.setRadius(o),
                a !== s._geometry && s._geometry.setRadius(o)
            }, function() {
                s._update("setRadius", a.getRadius())
            })
        }
        ,
        e.createEllipseOrRectEditor = function() {
            var P = this
              , M = [2, 1, 2, 0, 0, 2, 1, 2]
              , T = this._shadow || this._geometry;
            this._history || this._recordHistory(t());
            var S, E = this.getMap(), R = this._geometry instanceof Hh;
            this.options.fixAspectRatio && (S = T.getWidth() / T.getHeight());
            var A = this._createResizeHandles(null, function(t, e) {
                var i, n, r, o = R ? 1 : 2, s = A[e].getContainerPoint(), a = M[e];
                if (R) {
                    var h = A[7 - e].getContainerPoint()
                      , l = (i = s.sub(h)).abs();
                    n = E.pixelToDistance(l.x, 0),
                    r = E.pixelToDistance(0, l.y);
                    var u = T.getSize()
                      , c = T.getCoordinates()
                      , d = T.getWidth()
                      , f = T.getHeight()
                      , g = E.containerPointToCoord(t)
                      , p = E.containerPointToCoord(h)
                      , m = new Ph([[p.x, p.y], [g.x, p.y]])
                      , _ = new Ph([[p.x, p.y], [p.x, g.y]]);
                    if (n = E.computeGeometryLength(m),
                    r = E.computeGeometryLength(_),
                    0 === a)
                        if (S && (l.y = l.x / S,
                        u.height = Math.abs(l.y),
                        r = n / S),
                        s.y = h.y - u.height / 2,
                        g.y = c.y,
                        4 === e)
                            g.x = Math.min(g.x, c.x);
                        else {
                            var v = E.locate(c, d, 0);
                            g.x = E.locate(new Rr(v.x,g.y), -n, 0).x
                        }
                    else if (1 === a)
                        S && (l.x = l.y * S,
                        u.width = Math.abs(l.x),
                        n = r * S),
                        s.x = h.x - u.width / 2,
                        g.x = c.x,
                        g.y = Math.max(g.y, p.y);
                    else {
                        if (S && (r * S < n ? (r = n / S,
                        s.y = h.y + l.x * bt(i.y) / S) : (n = r * S,
                        s.x = h.x + l.y * bt(i.x) * S)),
                        0 === e || 5 === e) {
                            var y = 0 === e ? E.locate(c, d, 0) : E.locate(c, d, -f);
                            g.x = E.locate(new Rr(y.x,g.y), -n, 0).x
                        } else
                            g.x = Math.min(g.x, p.x);
                        g.y = Math.max(g.y, p.y)
                    }
                    T.setCoordinates(g),
                    P._updateCoordFromShadow(!0)
                } else {
                    var x = T.getCenter()
                      , w = E.containerPointToCoord(s)
                      , C = new Ph([[x.x, x.y], [w.x, x.y]])
                      , b = new Ph([[x.x, x.y], [x.x, w.y]]);
                    n = E.computeGeometryLength(C),
                    r = E.computeGeometryLength(b),
                    S && (r = (n = Math.max(n, r * S)) / S)
                }
                (S || 0 === a || 2 === a) && (T.setWidth(n * o),
                T !== P._geometry && P._geometry.setWidth(n * o)),
                (S || 1 === a || 2 === a) && (T.setHeight(r * o),
                T !== P._geometry && P._geometry.setHeight(r * o))
            }, function() {
                P._update(t())
            });
            function t() {
                return [["setCoordinates", T.getCoordinates().toArray()], ["setWidth", T.getWidth()], ["setHeight", T.getHeight()]]
            }
        }
        ,
        e.createPolygonEditor = function() {
            var l = this.getMap()
              , u = this._shadow || this._geometry
              , c = this;
            this._history || this._recordHistory("setCoordinates", Rr.toNumberArrays(u.getCoordinates()));
            var d = u instanceof yh ? 3 : 2
              , f = "maptalks--editor-vertex-index"
              , g = {
                0: []
            }
              , p = {
                0: []
            };
            function m(t) {
                if (void 0 === t && (t = 0),
                u instanceof yh) {
                    var e = u.getCoordinates()[t] || [];
                    return e.slice(0, e.length - 1)
                }
                return u.getCoordinates()
            }
            function _(t) {
                return void 0 === t && (t = 0),
                0 === t ? u._getPrjCoordinates() : u._getPrjHoles()[t - 1]
            }
            function v() {
                for (var t in g) {
                    for (var e = g[t].length - 1; 0 <= e; e--)
                        g[t][e][f] = e;
                    for (var i = p[t].length - 1; 0 <= i; i--)
                        p[t][i][f] = i
                }
                c._updateCoordFromShadow()
            }
            function i(t) {
                c._updating = !0;
                var e = t.target
                  , i = e[f]
                  , n = G(e._ringIndex) ? e._ringIndex : 0
                  , r = _(n);
                if (!(r.length <= d)) {
                    var o, s = u instanceof Ph && (0 === i || i === r.length - 1);
                    if (r.splice(i, 1),
                    0 < n ? u._prjHoles[n - 1] = r : u._setPrjCoordinates(r),
                    u._updateCache(),
                    g[n].splice(i, 1)[0].delete(),
                    i < p[n].length && p[n].splice(i, 1)[0].delete(),
                    o = 0 === i ? p[n].length - 1 : i - 1,
                    p[n].splice(o, 1)[0].delete(),
                    s || p[n].splice(o, 0, C.call(c, o, n)),
                    0 < n) {
                        var a = u.getCoordinates()
                          , h = a[n];
                        h && Array.isArray(h) && 1 < h.length && (h.splice(i, 1),
                        u !== this._geometry && u.setCoordinates(a))
                    }
                    v(),
                    c._updating = !1
                }
            }
            function y(t, e, i) {
                void 0 === i && (i = 0);
                var n = c._geometry.snapTo;
                n && H(n) && (t = c._geometry.snapTo(t) || t);
                var r, o = _(i), s = l._containerPointToPrj(t.sub(x())), a = o[e];
                a.x = s.x,
                a.y = s.y,
                u._updateCache(),
                u.onShapeChanged(),
                c._updateCoordFromShadow(!0),
                r = 0 === e ? p[i].length - 1 : e - 1,
                p[i][e] && p[i][e].refresh(),
                p[i][r] && p[i][r].refresh()
            }
            var e = new dt(0,0);
            function x() {
                var t = u._getCompiledSymbol();
                return e.x = t.lineDx || 0,
                e.y = t.lineDy || 0,
                e
            }
            function r(t, n, e) {
                void 0 === n && (n = 0);
                var r = (e || m(n))[t]
                  , o = c.createHandle(l.coordToContainerPoint(r)._add(x()), {
                    symbol: c.options.vertexHandleSymbol,
                    cursor: "pointer",
                    axis: null,
                    onMove: function() {
                        y(o.getContainerPoint(), o[f], n)
                    },
                    onRefresh: function(t, e) {
                        r = (e || m(n))[o[f]];
                        var i = l.coordToContainerPoint(r);
                        o.setContainerPoint(i._add(x()))
                    },
                    onUp: function() {
                        c._updateCoordFromShadow()
                    },
                    onDown: function(t, e) {
                        !e || !e.domEvent || e.domEvent.button
                    }
                });
                return o[f] = t,
                o._ringIndex = n,
                o.on(c.options.removeVertexOn, i),
                o
            }
            var w = !1;
            function C(t, s, e) {
                void 0 === s && (s = 0);
                var i, a = e || m(s);
                i = t + 1 >= a.length ? a[0] : a[t + 1];
                var n = a[t].add(i).multi(.5)
                  , h = c.createHandle(n, {
                    symbol: c.options.newVertexHandleSymbol,
                    cursor: "pointer",
                    axis: null,
                    onDown: function(t, e) {
                        if (!e || !e.domEvent || 2 !== e.domEvent.button) {
                            var i = _(s)
                              , n = h[f]
                              , r = h.getContainerPoint()
                              , o = l._containerPointToPrj(r);
                            i.splice(n + 1, 0, o),
                            0 < s ? u._prjHoles[s - 1] = i : u._setPrjCoordinates(i),
                            u._updateCache(),
                            h.opacity = 1,
                            p[s].splice(n, 0, C.call(c, n, s), C.call(c, n + 1, s)),
                            w = !0
                        }
                    },
                    onMove: function() {
                        y(h.getContainerPoint(), h[f] + 1, s)
                    },
                    onUp: function(t) {
                        if (t && t.domEvent && 2 === t.domEvent.button)
                            w = !1;
                        else {
                            var e = h[f];
                            xt(h, p[s]),
                            h.delete(),
                            g[s].splice(e + 1, 0, r.call(c, e + 1, s)),
                            v(),
                            c._updateCoordFromShadow(),
                            w = !1
                        }
                    },
                    onRefresh: function(t, e) {
                        a = e || m(t);
                        var i, n = h[f];
                        i = n === a.length - 1 ? 0 : n + 1;
                        var r = a[n].add(a[i]).multi(.5)
                          , o = l.coordToContainerPoint(r);
                        h.setContainerPoint(o._add(x()))
                    }
                });
                return h[f] = t,
                h
            }
            if (u instanceof yh)
                for (var t = u.getHoles().length + 1, n = 0; n < t; n++) {
                    g[n] = [],
                    p[n] = [];
                    for (var o = m(n), s = 0, a = o.length; s < a; s++)
                        g[n].push(r.call(this, s, n, o)),
                        s < a - 1 && p[n].push(C.call(this, s, n, o));
                    p[n].push(C.call(this, o.length - 1, n, o))
                }
            else {
                for (var h = m(0), b = 0, P = h.length; b < P; b++)
                    g[0].push(r.call(this, b, 0, h)),
                    b < P - 1 && p[0].push(C.call(this, b, 0, h));
                p[0].length && 2 === u.getCoordinates().length && (p[0][0].options.symbol.markerDx = 12)
            }
            this._addRefreshHook(function() {
                if (!w) {
                    for (var t in p)
                        for (var e = m(t), i = p[t].length - 1; 0 <= i; i--)
                            p[t][i].refresh(t, e);
                    for (var n in p[0].length && u instanceof Ph && (2 === u.getCoordinates().length ? p[0][0].options.symbol.markerDx = 12 : 2 < u.getCoordinates().length && (p[0][0].options.symbol.markerDx = 0)),
                    g)
                        for (var r = m(n), o = g[n].length - 1; 0 <= o; o--)
                            g[n][o].refresh(n, r)
                }
            })
        }
        ,
        e._refresh = function() {
            if (this._refreshHooks)
                for (var t = this._refreshHooks.length - 1; 0 <= t; t--)
                    this._refreshHooks[t].call(this)
        }
        ,
        e._hideContext = function() {
            this._geometry && (this._geometry.closeMenu(),
            this._geometry.closeInfoWindow())
        }
        ,
        e._addRefreshHook = function(t) {
            t && (this._refreshHooks || (this._refreshHooks = []),
            this._refreshHooks.push(t))
        }
        ,
        e._update = function(t) {
            for (var e = arguments.length, i = new Array(1 < e ? e - 1 : 0), n = 1; n < e; n++)
                i[n - 1] = arguments[n];
            this._exeHistory([t, i]),
            this._recordHistory.apply(this, [t].concat(i))
        }
        ,
        e._updateCoordFromShadow = function(t) {
            var e = (this._shadow || this._geometry).getCoordinates()
              , i = this._geometry
              , n = this._updating;
            this._updating = !0,
            i.setCoordinates(e),
            t || this._recordHistory("setCoordinates", Rr.toNumberArrays(i.getCoordinates())),
            this._updating = n
        }
        ,
        e._recordHistory = function(t) {
            this._history || (this._history = [],
            this._historyPointer = 0);
            for (var e = arguments.length, i = new Array(1 < e ? e - 1 : 0), n = 1; n < e; n++)
                i[n - 1] = arguments[n];
            if (this._history.length) {
                var r = this._history[this._history.length - 1];
                if (r[0] === t && JSON.stringify(r[1]) === JSON.stringify(i))
                    return
            }
            this._historyPointer < this._history.length - 1 && this._history.splice(this._historyPointer + 1),
            this._history.push([t, i]),
            this._historyPointer = this._history.length - 1,
            this._geometry.fire("editrecord")
        }
        ,
        e.cancel = function() {
            if (!this._history || 0 === this._historyPointer)
                return this;
            this._historyPointer = 0;
            var t = this._history[0];
            return this._exeAndReset(t),
            this
        }
        ,
        e.undo = function() {
            if (!this._history || 0 === this._historyPointer)
                return this;
            var t = this._history[--this._historyPointer];
            return this._exeAndReset(t),
            this
        }
        ,
        e.redo = function() {
            if (!this._history || this._historyPointer === this._history.length - 1)
                return this;
            var t = this._history[++this._historyPointer];
            return this._exeAndReset(t),
            this
        }
        ,
        e._exeAndReset = function(t) {
            if (!this._updating) {
                this._exeHistory(t);
                var e = this._history
                  , i = this._historyPointer;
                this.stop(),
                this._history = e,
                this._historyPointer = i,
                this.start()
            }
        }
        ,
        e._onDragStart = function() {
            this._updating = !0
        }
        ,
        e._onDragEnd = function() {
            this._updating = !1
        }
        ,
        e._exeHistory = function(t) {
            if (Array.isArray(t)) {
                var e = this._updating;
                this._updating = !0;
                var n = this._shadow || this._geometry
                  , r = this._geometry;
                Array.isArray(t[0]) ? t[0].forEach(function(t) {
                    var e = t[0]
                      , i = t.slice(1);
                    n[e].apply(n, i),
                    n !== r && r[e].apply(r, i)
                }) : (n[t[0]].apply(n, t[1]),
                n !== r && r[t[0]].apply(r, t[1])),
                this._updating = e
            }
        }
        ,
        t
    }(Un(qn));
    od.mergeOptions(rd);
    var sd = {
        startEditText: function() {
            return this.getMap() && (this.hide(),
            this.endEditText(),
            this._prepareEditor(),
            this._fireEvent("edittextstart")),
            this
        },
        endEditText: function() {
            if (this._textEditor) {
                var t = this._textEditor.innerHTML;
                t = t.replace(/<p>/gi, "").replace(/<\/p>/gi, "<br/>"),
                this._textEditor.innerHTML = t;
                var e = this._textEditor.innerText.replace(/[\r\n]+$/gi, "");
                this.setContent(e),
                zi(this._textEditor, "mousedown dblclick", wi),
                this.getMap().off("mousedown", this.endEditText, this),
                this._editUIMarker.remove(),
                delete this._editUIMarker,
                this._textEditor.onkeyup = null,
                delete this._textEditor,
                this.show(),
                this._fireEvent("edittextend")
            }
            return this
        },
        isEditingText: function() {
            return !!this._textEditor
        },
        getTextEditor: function() {
            return this._editUIMarker
        },
        _prepareEditor: function() {
            var t = this.getMap()
              , e = this._createEditor();
            this._textEditor = e,
            t.on("mousedown", this.endEditText, this);
            var i = this._getEditorOffset();
            this._editUIMarker = new wu(this.getCoordinates(),{
                animation: null,
                content: e,
                dx: i.dx,
                dy: i.dy
            }).addTo(t),
            this._setCursorToLast(this._textEditor)
        },
        _getEditorOffset: function() {
            var t = this._getInternalSymbol() || {}
              , e = 0
              , i = 0
              , n = t.textHorizontalAlignment;
            return "middle" === n || ut(n) ? (e = (t.textDx || 0) - 2,
            i = (t.textDy || 0) - 2) : (e = (t.markerDx || 0) - 2,
            i = (t.markerDy || 0) - 2),
            {
                dx: e,
                dy: i
            }
        },
        _createEditor: function() {
            var t = this.getContent()
              , e = this.getSize()
              , i = this._getInternalSymbol() || {}
              , n = e.width
              , r = i.textFill || "#000000"
              , o = i.textSize || 12
              , s = e.height
              , a = i.markerLineColor || "#000"
              , h = i.markerFill || "#3398CC"
              , l = i.textLineSpacing || 0
              , u = gi("div");
            return u.contentEditable = !0,
            u.style.cssText = "background:" + h + "; border:1px solid " + a + ";\n            color:" + r + ";font-size:" + o + "px;width:" + (n - 2) + "px;height:" + (s - 2) + "px;margin: auto;\n            line-height:" + (o + l) + "px;outline: 0; padding:0; margin:0;word-wrap: break-word;\n            overflow: hidden;-webkit-user-modify: read-write-plaintext-only;",
            u.innerText = t,
            Ii(u, "mousedown dblclick", wi),
            u.onkeyup = function(t) {
                var e = u.style.height || 0;
                13 === t.keyCode && (u.style.height = parseInt(e) + o / 2 + "px")
            }
            ,
            u
        },
        _setCursorToLast: function(t) {
            var e;
            window.getSelection ? (t.focus(),
            (e = window.getSelection()).selectAllChildren(t),
            e.collapseToEnd()) : document.selection && ((e = document.selection.createRange()).moveToElementText(t),
            e.collapse(!1),
            e.select())
        }
    };
    qh.include(sd),
    sa.include({
        animate: function(t, e, u) {
            var c = this;
            this._animPlayer && this._animPlayer.finish(),
            H(e) && (u = e),
            e || (e = {});
            var d, f = this.getMap(), g = this._getProjection(), i = this._prepareAnimationStyles(t), p = e.focus;
            if (delete this._animationStarted,
            f) {
                var n = f._getRenderer();
                e.framer = function(t) {
                    n.callInNextFrame(t)
                }
            }
            var m = fh.animate(i, e, function(t) {
                if (f && f.isRemoved())
                    m.finish();
                else {
                    f && !c._animationStarted && p && f.onMoveStart();
                    var e = t.styles;
                    for (var i in e)
                        if ("symbol" !== i && "translate" !== i && e.hasOwnProperty(i)) {
                            var n = "set" + i[0].toUpperCase() + i.slice(1);
                            c[n](e[i])
                        }
                    var r = e.translate;
                    if (r) {
                        var o = r;
                        d && (o = r.sub(d)),
                        d = r,
                        c.translate(o)
                    }
                    var s = e.symbol;
                    if (s) {
                        var a = c.getSymbol() || {};
                        c.setSymbol(ei(a, s))
                    }
                    if (f && p) {
                        var h = g.project(c.getCenter());
                        f._setPrjCenter(h);
                        var l = f._parseEventFromCoord(g.unproject(h));
                        "running" !== m.playState ? f.onMoveEnd(l) : f.onMoving(l)
                    }
                    c._fireAnimateEvent(m.playState),
                    u && u(t)
                }
            }, this);
            return this._animPlayer = m,
            this._animPlayer.play()
        },
        _prepareAnimationStyles: function(t) {
            var e = this._getInternalSymbol()
              , i = {};
            for (var n in t)
                if (t.hasOwnProperty(n)) {
                    var r = t[n];
                    if ("translate" !== n && "symbol" !== n) {
                        var o = this["get" + n[0].toUpperCase() + n.substring(1)]();
                        i[n] = [o, r]
                    } else if ("symbol" === n) {
                        var s = void 0;
                        if (Array.isArray(t.symbol)) {
                            if (!Array.isArray(e))
                                throw new Error("geometry'symbol isn't a composite symbol, while the symbol in styles is.");
                            s = [];
                            for (var a = t.symbol, h = 0; h < a.length; h++)
                                if (a[h]) {
                                    var l = {};
                                    for (var u in a[h])
                                        a[h].hasOwnProperty(u) && (l[u] = [e[h][u], a[h][u]]);
                                    s.push(l)
                                } else
                                    s.push(null)
                        } else {
                            if (Array.isArray(e))
                                throw new Error("geometry'symbol is a composite symbol, while the symbol in styles isn't.");
                            for (var c in s = {},
                            r)
                                r.hasOwnProperty(c) && (s[c] = [e[c], r[c]])
                        }
                        i.symbol = s
                    } else
                        "translate" === n && (i.translate = new Rr(r))
                }
            return i
        },
        _fireAnimateEvent: function(t) {
            "finished" === t ? (delete this._animationStarted,
            this._fireEvent("animateend")) : "running" === t && (this._animationStarted ? this._fireEvent("animating") : (this._fireEvent("animatestart"),
            this._animationStarted = !0))
        }
    });
    var ad = g + "_drag_stage"
      , hd = $.touch ? "touchstart mousedown" : "mousedown"
      , ld = function(e) {
        function t(t) {
            return e.call(this, t) || this
        }
        it(t, e);
        var i = t.prototype;
        return i.addHooks = function() {
            this.target.on(hd, this._startDrag, this)
        }
        ,
        i.removeHooks = function() {
            this._endDrag(),
            this.target.off(hd, this._startDrag, this),
            delete this.container
        }
        ,
        i._prepareDragHandler = function() {
            this._dragHandler = new Er(this.container),
            this._dragHandler.on("dragging", this._dragging, this).on("mouseup", this._endDrag, this).enable()
        }
        ,
        i._prepareShadow = function() {
            var i = this
              , t = this.target;
            if ("canvas" === t.getLayer().options.renderer) {
                this._prepareDragStageLayer(),
                this._shadow && this._shadow.remove();
                var e = this._shadow = t.copy();
                if (e.getGeometries) {
                    var n = e.getGeometries()
                      , r = t.getGeometries();
                    n.forEach(function(t, e) {
                        i._updateShadowSymbol(t, r[e])
                    })
                } else
                    this._updateShadowSymbol(e, t);
                e.setId(null),
                this._prepareShadowConnectors()
            }
        }
        ,
        i._updateShadowSymbol = function(t, e) {
            if (t.setSymbol(e._getInternalSymbol()),
            e.options.dragShadow) {
                var i = ti(t._getInternalSymbol(), .5);
                t.setSymbol(i)
            }
        }
        ,
        i._prepareShadowConnectors = function() {
            var t = this.target
              , e = this._shadow
              , i = this._dragStageLayer._getRenderer().resources
              , n = [];
            if ($h._hasConnectors(t))
                for (var r = $h._getConnectors(t), o = 0, s = r.length; o < s; o++) {
                    var a = r[o]
                      , h = a.config()
                      , l = a._getInternalSymbol();
                    h.symbol = ti(l, .5);
                    var u = void 0;
                    u = a.getConnectSource() === t ? new a.constructor(e,a.getConnectTarget(),h) : new a.constructor(a.getConnectSource(),e,h),
                    n.push(u),
                    a.getLayer() && a.getLayer()._getRenderer() && i.merge(a.getLayer()._getRenderer().resources)
                }
            (this._shadowConnectors = n).push(e),
            this._dragStageLayer.bringToFront().addGeometry(n)
        }
        ,
        i._onTargetUpdated = function() {
            this._shadow && this._shadow.setSymbol(this.target._getSymbol())
        }
        ,
        i._prepareDragStageLayer = function() {
            var t = this.target.getMap()
              , e = this.target.getLayer();
            this._dragStageLayer = t.getLayer(ad),
            this._dragStageLayer || (this._dragStageLayer = new sl(ad,{
                enableAltitude: e.options.enableAltitude,
                altitudeProperty: e.options.altitudeProperty
            }),
            t.addLayer(this._dragStageLayer));
            var i = new zo;
            i.merge(e._getRenderer().resources),
            this._dragStageLayer._getRenderer().resources = i
        }
        ,
        i._startDrag = function(t) {
            var e = this.target.getMap();
            if (e && (!this.target._getParent() && !this.isDragging())) {
                var i = t.domEvent;
                i.touches && 1 < i.touches.length || 2 === i.button || (this.container = e._panels.mapWrapper || e._containerDOM,
                this.target.on("click", this._endDrag, this),
                this._lastCoord = this._correctCoord(t.coordinate),
                this._lastPoint = t.containerPoint,
                this._prepareDragHandler(),
                this._dragHandler.onMouseDown(t.domEvent),
                Ii(this.container, "mouseleave", this._endDrag, this),
                this._startParam = t,
                this._moved = !1)
            }
        }
        ,
        i._dragging = function(t) {
            var e = this.target
              , i = e.getMap();
            if (!i._isEventOutMap(t.domEvent)) {
                var n = i._parseEvent(t.domEvent)
                  , r = n.domEvent;
                if (!(r.touches && 1 < r.touches.length)) {
                    var o = i._getVisualHeight(i.options.maxVisualPitch);
                    if (!(n.containerPoint.y < i.height - o)) {
                        if (!this._moved)
                            return this._moved = !0,
                            e.on("symbolchange", this._onTargetUpdated, this),
                            this._isDragging = !0,
                            this._prepareShadow(),
                            this._shadow && (e.options.dragShadow || e.hide(),
                            this._shadow._fireEvent("dragstart", n)),
                            this.target._fireEvent("dragstart", this._startParam || n),
                            void delete this._startParam;
                        var s = this._shadow || e
                          , a = s.options.dragOnAxis
                          , h = s.options.dragOnScreenAxis
                          , l = n.containerPoint
                          , u = n.coordinate;
                        this._lastPoint = this._lastPoint || l,
                        this._lastCoord = this._lastCoord || u,
                        h ? ("x" === a ? l.y = this._lastPoint.y : "y" === a && (l.x = this._lastPoint.x),
                        u = i.containerPointToCoord(l)) : u = this._correctCoord(u);
                        var c = l.sub(this._lastPoint)
                          , d = u.sub(this._lastCoord);
                        h || ("x" === a ? c.y = d.y = 0 : "y" === a && (c.x = d.x = 0)),
                        this._lastPoint = l,
                        this._lastCoord = u,
                        s.translate(d),
                        s === e || e.options.dragShadow || e.translate(d),
                        n.coordOffset = d,
                        n.pointOffset = c,
                        s._fireEvent("dragging", n),
                        s !== e && e._fireEvent("dragging", n)
                    }
                }
            }
        }
        ,
        i._endDrag = function(t) {
            if (this._dragHandler && (this._dragHandler.disable(),
            delete this._dragHandler),
            this.container && zi(this.container, "mouseleave", this._endDrag, this),
            this.target) {
                var e = this.target;
                e.off("click", this._endDrag, this),
                e.off("symbolchange", this._onTargetUpdated, this),
                delete this._lastCoord,
                delete this._lastPoint,
                this._isDragging = !1;
                var i = e.getMap();
                if (this.enabled() && i) {
                    var n = i._parseEvent(t ? t.domEvent : null);
                    this._updateTargetAndRemoveShadow(n),
                    this._moved && e._fireEvent("dragend", n)
                }
            }
        }
        ,
        i.isDragging = function() {
            return !!this._isDragging
        }
        ,
        i._updateTargetAndRemoveShadow = function(t) {
            if (this._shadow) {
                var e = this.target
                  , i = e.getMap();
                e.options.dragShadow || e.show();
                var n = this._shadow;
                if (n) {
                    if (e.options.dragShadow) {
                        var r = n.getFirstCoordinate()
                          , o = e.getFirstCoordinate()
                          , s = r.sub(o);
                        e.translate(s)
                    }
                    n._fireEvent("dragend", t),
                    n.remove(),
                    delete this._shadow
                }
                this._shadowConnectors && (i.getLayer(ad).removeGeometry(this._shadowConnectors),
                delete this._shadowConnectors),
                this._dragStageLayer && (this._dragStageLayer._getRenderer().resources = new zo,
                this._dragStageLayer.remove())
            }
        }
        ,
        i._correctCoord = function(t) {
            var e = this.target.getMap();
            if (!e.getPitch())
                return t;
            var i = this.target;
            if (!i.getMinAltitude())
                return t;
            var n = (i.getMinAltitude() + i.getMaxAltitude()) / 2;
            return e.locateByPoint(t, 0, -n)
        }
        ,
        t
    }(Jn);
    sa.mergeOptions({
        draggable: !1,
        dragShadow: !0,
        dragOnAxis: null,
        dragOnScreenAxis: !1
    }),
    sa.addInitHook("addHandler", "draggable", ld),
    sa.include({
        isDragging: function() {
            return this._getParent() ? this._getParent().isDragging() : !!this.draggable && this.draggable.isDragging()
        }
    }),
    sa.include({
        startEdit: function(t) {
            var e = this.getMap();
            return e && this.options.editable && (this._editor && this.endEdit(),
            this._editor = new od(this,t),
            this._editor.start(),
            this._getParent() || this.fire("editstart"),
            e.getRenderer().setToRedraw()),
            this
        },
        endEdit: function() {
            if (this._editor) {
                this._editor.stop(),
                delete this._editor,
                this._getParent() || this.fire("editend");
                var t = this.getMap();
                t && t.getRenderer().setToRedraw()
            }
            return this
        },
        redoEdit: function() {
            return this.isEditing() && (this._editor.redo(),
            this._getParent() || this.fire("redoedit")),
            this
        },
        undoEdit: function() {
            return this.isEditing() && (this._editor.undo(),
            this._getParent() || this.fire("undoedit")),
            this
        },
        cancelEdit: function() {
            return this.isEditing() && (this._editor.cancel(),
            this._getParent() || this.fire("canceledit")),
            this
        },
        isEditing: function() {
            return !!this._editor && this._editor.isEditing()
        }
    }),
    sa.include({
        _onEvent: function(t, e) {
            var i = this.getMap();
            if (i) {
                var n = e || this._getEventTypeToFire(t);
                "contextmenu" === n && this.listens("contextmenu") && (wi(t),
                xi(t));
                var r = i._getEventParams(t);
                G(this._pickGeometryIndex) && (r.pickGeometryIndex = this._pickGeometryIndex),
                this._fireEvent(n, r)
            }
        },
        _getEventTypeToFire: function(t) {
            return t.type
        }
    }),
    sa.include({
        setInfoWindow: function(t) {
            return this.removeInfoWindow(),
            t instanceof Su ? (this._infoWindow = t,
            this._infoWinOptions = F({}, this._infoWindow.options),
            this._infoWindow.addTo(this)) : (this._infoWinOptions = F({}, t),
            this._infoWindow ? this._infoWindow.setOptions(t) : this.getMap() && this._bindInfoWindow()),
            this
        },
        getInfoWindow: function() {
            return this._infoWindow ? this._infoWindow : null
        },
        openInfoWindow: function(t) {
            return this.getMap() && (t || (t = this.getCenter()),
            this._infoWindow ? this._infoWindow.show(t) : this._infoWinOptions && this.getMap() && (this._bindInfoWindow(),
            this._infoWindow.show(t))),
            this
        },
        closeInfoWindow: function() {
            return this._infoWindow && this._infoWindow.hide(),
            this
        },
        removeInfoWindow: function() {
            return this._unbindInfoWindow(),
            delete this._infoWinOptions,
            delete this._infoWindow,
            this
        },
        _bindInfoWindow: function() {
            var t = this._infoWinOptions;
            return t && (this._infoWindow = new Su(t),
            this._infoWindow.addTo(this)),
            this
        },
        _unbindInfoWindow: function() {
            return this._infoWindow && (this.closeInfoWindow(),
            this._infoWindow.remove(),
            delete this._infoWindow),
            this
        }
    });
    var ud = new dt(0,0)
      , cd = new dt(0,0)
      , dd = new dt(0,0)
      , fd = new dt(0,0)
      , gd = []
      , pd = function(t) {
        function e() {
            return t.call(this, Vi) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.checkUrl = function(t) {
            return t && P(t) ? Zt(t) : t
        }
        ,
        i.fetchImage = function(t, e, i, n) {
            var r = {
                url: t = this.checkUrl(t),
                fetchOptions: n
            };
            this.send(r, gd, i, e)
        }
        ,
        e
    }(Oo)
      , md = function(n) {
        function t(t) {
            var e;
            (e = n.call(this, t) || this).tilesInView = {},
            e.tilesLoading = {},
            e._parentTiles = [],
            e._childTiles = [],
            e._tileQueue = [],
            e._tileQueueIds = new Set;
            var i = t.getTileSize().width;
            return e.tileCache = new bn(t.options.maxCacheSize * i / 512 * i / 512,function(t) {
                e.deleteTile(t)
            }
            ),
            $.decodeImageInWorker && e.layer.options.decodeImageInWorker && ("gl" === t.options.renderer || !$.safari && !$.iosWeixin) && (e._tileImageWorkerConn = new pd),
            e._compareTiles = function(t, e) {
                return Math.abs(this._tileZoom - t.info.z) - Math.abs(this._tileZoom - e.info.z)
            }
            .bind(at(at(e))),
            e
        }
        it(t, n);
        var e = t.prototype;
        return e.getCurrentTileZoom = function() {
            return this._tileZoom
        }
        ,
        e.draw = function(t, e) {
            var i = this.getMap();
            if (this.isDrawable()) {
                var n = this.prepareCanvas();
                if (!n || n.intersects(this.canvasExtent2D)) {
                    var r;
                    this._renderTimestamp !== t && (this._consumeTileQueue(),
                    this._computeAvgTileAltitude(),
                    this._renderTimestamp = t);
                    var o = !1
                      , s = this._frameTiles;
                    if (s && t === s.timestamp) {
                        if (s.empty)
                            return;
                        r = s
                    } else {
                        if (!(r = this._getTilesInCurrentFrame()))
                            return this._frameTiles = {
                                empty: !0,
                                timestamp: t
                            },
                            void this.completeRender();
                        o = !0,
                        this._frameTiles = r,
                        this._frameTiles.timestamp = t,
                        r.loadingCount && this.loadTileQueue(r.tileQueue)
                    }
                    var a = r
                      , h = a.tiles
                      , l = a.childTiles
                      , u = a.parentTiles
                      , c = a.placeholders
                      , d = a.loading
                      , f = a.loadingCount
                      , g = a.missedTiles
                      , p = a.incompleteTiles;
                    this._drawTiles(h, u, l, c, e, g, p),
                    f || d || (i.isAnimating() || !this._parentTiles.length && !this._childTiles.length || (this._parentTiles = [],
                    this._childTiles = [],
                    this.setToRedraw()),
                    this.completeRender()),
                    o && this.retireTiles()
                } else
                    this.completeRender()
            }
        }
        ,
        e.getTileGridsInCurrentFrame = function() {
            return this._frameTileGrids
        }
        ,
        e.getCurrentTimestamp = function() {
            return this._renderTimestamp || 0
        }
        ,
        e._getTilesInCurrentFrame = function() {
            var t = this.getMap()
              , e = this.layer
              , i = e._isPyramidMode() && e.options.terrainTileMode
              , n = e.getTiles();
            if (!(n = (this._frameTileGrids = n).tileGrids) || !n.length)
                return null;
            var r = n.reduce(function(t, e) {
                return t + (e && e.tiles && e.tiles.length || 0)
            }, 0);
            r >= this.tileCache.max / 2 && this.tileCache.setMaxSize(2 * r + 1);
            var o = 0
              , s = !1
              , a = {}
              , h = []
              , l = []
              , u = {}
              , c = []
              , d = {}
              , f = []
              , g = {}
              , p = {}
              , m = this.markTiles()
              , _ = this._getLoadLimit()
              , v = n.length
              , y = void 0 === this._tileZoom && e.options.currentTilesFirst && !this._terrainHelper;
            this._tileZoom = n[0].zoom;
            var x = null
              , w = null;
            i && (x = [],
            w = new Map);
            for (var C = 0; C < v; C++) {
                var b = n[C]
                  , P = b.tiles
                  , M = b.parents || gd
                  , T = M.length
                  , S = y ? P : M.concat(P)
                  , E = void 0;
                S.length && (E = this._generatePlaceHolder(S[0].res));
                for (var R = 0, A = S.length; R < A; R++) {
                    var k = S[R]
                      , O = k.id
                      , L = R < T
                      , D = !1
                      , I = h.length;
                    if (this._isLoadingTile(O))
                        D = s = !0,
                        this.markCurrent(this.tilesLoading[O], !0);
                    else {
                        var z = this.getCachedTile(k, L);
                        if (z)
                            L || (z.image && this.isTileFadingIn(z.image) && (D = s = !0,
                            this.setToRedraw()),
                            this.isTileComplete(z) ? h.push(z) : (D = !0,
                            i && w.set(O, z)));
                        else {
                            D = s = !0;
                            var j = _ && o + m[0] > _;
                            if (!this._tileQueueIds.has(k.id) && !j && (!t.isInteracting() || t.isMoving() || t.isRotating()))
                                o++,
                                p[O] = k
                        }
                    }
                    if (i && !L && (h.length === I ? x.push(k) : a[k.id] = 1),
                    !i && !L && D && !a[O]) {
                        a[O] = 1,
                        E && !g[O] && (k.cache = !1,
                        f.push({
                            image: E,
                            info: k
                        }),
                        g[O] = 1);
                        var F = this._findChildTiles(k);
                        if (F.length && F.forEach(function(t) {
                            d[t.info.id] || (c.push(t),
                            d[t.info.id] = 1)
                        }),
                        !F.length || 4 !== F.length) {
                            var G = this._findParentTile(k);
                            if (G) {
                                var H = G.info.id;
                                void 0 === u[H] && (u[H] = l.length,
                                l.push(G))
                            }
                        }
                    }
                }
            }
            var B = [];
            if (i)
                for (var N = 0; N < x.length; N++) {
                    var Z = x[N].info ? x[N].info : x[N];
                    if (Z.parent && !a[Z.id]) {
                        var W = this._findChildTiles(Z)
                          , V = W.tiles
                          , U = W.missedTiles;
                        V.length ? (yt(h, V),
                        yt(B, U)) : w.has(Z.id) ? (h.push(w.get(Z.id)),
                        w.delete(Z.id)) : (a[Z.id] = 1,
                        B.push(Z))
                    }
                }
            return this.tileCache.shrink(),
            {
                childTiles: c,
                missedTiles: B,
                parentTiles: l,
                tiles: h,
                incompleteTiles: w && Array.from(w.values()),
                placeholders: f,
                loading: s,
                loadingCount: o,
                tileQueue: p
            }
        }
        ,
        e.removeTileCache = function(t) {
            delete this.tilesInView[t],
            this.tileCache.remove(t)
        }
        ,
        e.isTileCachedOrLoading = function(t) {
            return this.tileCache.get(t) || this.tilesInView[t] || this.tilesLoading[t]
        }
        ,
        e.isTileCached = function(t) {
            return !(!this.tileCache.get(t) && !this.tilesInView[t])
        }
        ,
        e.isTileFadingIn = function(t) {
            return this._getTileFadingOpacity(t) < 1
        }
        ,
        e._drawTiles = function(t, e, i, n, r) {
            var o = this;
            e.length && (e.sort(this._compareTiles),
            this._parentTiles = e),
            i.length && (this._childTiles = i,
            this._childTiles.sort(this._compareTiles));
            var s = !0
              , a = this.canvas._parentTileTimestamp;
            this.layer.constructor !== mc && this.layer.constructor !== Mc || (this._renderTimestamp === a ? s = !1 : this.canvas._parentTileTimestamp = this._renderTimestamp);
            var h = "gl" === this.layer.options.renderer && (!this.isGL || this.isGL())
              , l = {
                tiles: t,
                parentTiles: this._parentTiles,
                childTiles: this._childTiles,
                parentContext: r
            };
            if (this.onDrawTileStart(l, r),
            s && 1 === this.layer.options.opacity) {
                this.layer._silentConfig = !0;
                var u = this.layer.options.fadeAnimation;
                this.layer.options.fadeAnimation = !1,
                h ? (this._drawChildTiles(i, r),
                this._drawParentTiles(this._parentTiles, r)) : (this._drawParentTiles(this._parentTiles, r),
                this._drawChildTiles(i, r)),
                this.layer.options.fadeAnimation = u,
                this.layer._silentConfig = !1
            }
            this.drawingCurrentTiles = !0,
            t.sort(this._compareTiles);
            for (var c = 0, d = t.length; c < d; c++)
                this._drawTileAndCache(t[c], r);
            if (delete this.drawingCurrentTiles,
            s && this.layer.options.opacity < 1) {
                this.layer._silentConfig = !0;
                var f = this.layer.options.fadeAnimation;
                this.layer.options.fadeAnimation = !1,
                h ? (this._drawChildTiles(i, r),
                this._drawParentTiles(this._parentTiles, r)) : (this._drawParentTiles(this._parentTiles, r),
                this._drawChildTiles(i, r)),
                this.layer.options.fadeAnimation = f,
                this.layer._silentConfig = !1
            }
            n.forEach(function(t) {
                return o._drawTile(t.info, t.image, r)
            }),
            this.onDrawTileEnd(l, r)
        }
        ,
        e._drawChildTiles = function(t, e) {
            var i = this;
            this.drawingChildTiles = !0,
            t.forEach(function(t) {
                return i._drawTile(t.info, t.image, e)
            }),
            delete this.drawingChildTiles
        }
        ,
        e._drawParentTiles = function(t, e) {
            var i = this;
            this.drawingParentTiles = !0,
            this._parentTiles.forEach(function(t) {
                return i._drawTile(t.info, t.image, e)
            }),
            delete this.drawingParentTiles
        }
        ,
        e.onDrawTileStart = function() {}
        ,
        e.onDrawTileEnd = function() {}
        ,
        e._drawTile = function(t, e, i) {
            e && this.drawTile(t, e, i)
        }
        ,
        e._drawTileAndCache = function(t, e) {
            this.isValidCachedTile(t) && this._addTileToCache(t.info, t.image),
            this._drawTile(t.info, t.image, e)
        }
        ,
        e.drawOnInteracting = function(t, e, i) {
            this.draw(e, i)
        }
        ,
        e.needToRedraw = function() {
            var t = this.getMap();
            return !!this._tileQueue.length || (t.getPitch() ? n.prototype.needToRedraw.call(this) : !(!t.isRotating() && !t.isZooming()) || (t.isMoving() ? !!this.layer.options.forceRenderOnMoving : n.prototype.needToRedraw.call(this)))
        }
        ,
        e.hitDetect = function() {
            return !1
        }
        ,
        e._getLoadLimit = function() {
            return this.getMap().isInteracting() ? this.layer.options.loadingLimitOnInteracting : this.layer.options.loadingLimit || 0
        }
        ,
        e.isDrawable = function() {
            return !this.getMap().getPitch() || (console && console.warn("TileLayer with canvas renderer can't be pitched, use gl renderer ('renderer' : 'gl') instead."),
            this.clear(),
            !1)
        }
        ,
        e.clear = function() {
            this.retireTiles(!0),
            this.tileCache.reset(),
            this.tilesInView = {},
            this.tilesLoading = {},
            this._tileQueue = [],
            this._tileQueueIds.clear(),
            this._parentTiles = [],
            this._childTiles = [],
            n.prototype.clear.call(this)
        }
        ,
        e._isLoadingTile = function(t) {
            return !!this.tilesLoading[t]
        }
        ,
        e.clipCanvas = function(t) {
            return n.prototype.clipCanvas.call(this, t)
        }
        ,
        e._clipByPitch = function(t) {
            var e = this.getMap();
            if (e.getPitch() <= e.options.maxVisualPitch)
                return !1;
            if (!this.layer.options.clipByPitch)
                return !1;
            var i = e.getContainerExtent()
              , n = e.getDevicePixelRatio();
            return t.save(),
            t.strokeStyle = "rgba(0, 0, 0, 0)",
            t.beginPath(),
            t.rect(0, Math.ceil(i.ymin) * n, Math.ceil(i.getWidth()) * n, Math.ceil(i.getHeight()) * n),
            t.stroke(),
            t.clip(),
            !0
        }
        ,
        e.loadTileQueue = function(t) {
            for (var e in t)
                if (t.hasOwnProperty(e)) {
                    var i = t[e]
                      , n = this.loadTile(i);
                    void 0 === n.loadTime && (this.tilesLoading[i.id] = {
                        image: n,
                        current: !0,
                        info: i
                    })
                }
        }
        ,
        e.loadTile = function(e) {
            var i = this
              , t = {};
            if (this.loadTileBitmap) {
                this.loadTileBitmap(e.url, e, function(t) {
                    i.onTileLoad(t, e)
                })
            } else if (this._tileImageWorkerConn && this.loadTileImage === this.constructor.prototype.loadTileImage)
                this._fetchImage(t, e);
            else {
                var n = this.layer.getTileSize(e.layer);
                (t = new Image).width = n.width,
                t.height = n.height,
                t.onload = this.onTileLoad.bind(this, t, e),
                t.onerror = this.onTileError.bind(this, t, e),
                this.loadTileImage(t, e.url)
            }
            return t
        }
        ,
        e._fetchImage = function(i, n) {
            var r = this;
            if (i instanceof Image)
                i.src = n.url;
            else {
                var t = n.x
                  , e = n.y
                  , o = Math.abs(t + e) % this._tileImageWorkerConn.workers.length;
                this._tileImageWorkerConn.fetchImage(n.url, o, function(t, e) {
                    t ? r.onTileError(i, n, t) : Nt(e, function(t) {
                        r.onTileLoad(t, n)
                    })
                }, this.layer.options.fetchOptions || {
                    referrer: document.location.href,
                    headers: {
                        accept: "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8"
                    }
                })
            }
        }
        ,
        e.loadTileImage = function(t, e) {
            var i = this.layer.options.crossOrigin;
            return ut(i) || (t.crossOrigin = i),
            gt(t, [e])
        }
        ,
        e.abortTileLoading = function(t, e) {
            e && void 0 !== e.id && this.removeTileLoading(e),
            t && t instanceof Image && (t.onload = _d,
            t.onerror = _d,
            t.src = jt)
        }
        ,
        e.onTileLoad = function(t, e) {
            this.removeTileLoading(e),
            this._tileQueue.push({
                tileInfo: e,
                tileData: t
            }),
            this._tileQueueIds.add(e.id),
            this.setToRedraw()
        }
        ,
        e.removeTileLoading = function(t) {
            delete this.tilesLoading[t.id],
            this.setToRedraw()
        }
        ,
        e._consumeTileQueue = function() {
            for (var t = 0, e = this.layer.options.tileLimitPerFrame, i = this._tileQueue; i.length && (e <= 0 || t < e); ) {
                var n = i.shift()
                  , r = n.tileData
                  , o = n.tileInfo;
                this._tileQueueIds.has(o.id) && (this._tileQueueIds.delete(o.id),
                this.checkTileInQueue(r, o) && (this.consumeTile(r, o),
                t++))
            }
        }
        ,
        e._computeAvgTileAltitude = function() {
            var t = 0
              , e = 0
              , i = 0;
            for (var n in this.tilesInView) {
                var r = this.tilesInView[n] && this.tilesInView[n].info;
                r && (t += r.minAltitude || 0,
                e += r.maxAltitude || 0,
                i++)
            }
            this.avgMinAltitude = t / i,
            this.avgMaxAltitude = e / i
        }
        ,
        e.checkTileInQueue = function() {
            return !0
        }
        ,
        e.consumeTile = function(t, e) {
            if (this.layer && this.tilesInView) {
                var i = {
                    tile: e,
                    tileImage: t
                };
                t = i.tileImage,
                this.resetTileLoadTime(t),
                this.removeTileLoading(e),
                this._addTileToCache(e, t),
                this.layer.fire("tileload", i),
                this.setToRedraw()
            }
        }
        ,
        e.resetTileLoadTime = function(t) {
            0 !== t.loadTime && (t.loadTime = x())
        }
        ,
        e.onTileError = function(t, e) {
            if (this.layer) {
                if (t.onerrorTick = t.onerrorTick || 0,
                this.layer.options.tileRetryCount > t.onerrorTick)
                    return t.onerrorTick++,
                    this._fetchImage(t, e),
                    void this.removeTileLoading(e);
                var i = this.layer.options.errorUrl;
                if (i) {
                    if (t instanceof Image && t.src !== i)
                        return t.src = i,
                        void this.removeTileLoading(e);
                    (t = new Image).src = i
                }
                this.abortTileLoading(t, e),
                t.loadTime = 0,
                this.removeTileLoading(e),
                this._addTileToCache(e, t),
                this.setToRedraw(),
                this.layer.fire("tileerror", {
                    tile: e
                })
            }
        }
        ,
        e.drawTile = function(t, e) {
            if (e && this.getMap()) {
                var i = t.extent2d
                  , n = t.offset
                  , r = ud.set(i.xmin - n[0], i.ymax - n[1])
                  , o = t.z
                  , s = t.id
                  , a = this.getMap()
                  , h = a.getZoom()
                  , l = this.context
                  , u = a._pointAtResToContainerPoint(r, t.res, 0, cd)
                  , c = a.getBearing()
                  , d = c || h !== o
                  , f = this.getTileOpacity(e, t)
                  , g = l.globalAlpha;
                f < 1 && (l.globalAlpha = f),
                d || u._round();
                var p = u.x
                  , m = u.y
                  , _ = t.extent2d.xmax - t.extent2d.xmin
                  , v = t.extent2d.ymax - t.extent2d.ymin
                  , y = this.layer
                  , x = y ? y.options.bufferPixel : 0;
                if (d) {
                    l.save(),
                    l.translate(p, m),
                    c && l.rotate(-c * Math.PI / 180),
                    _ += x,
                    v += x;
                    var w = a._getResolution();
                    if (w !== t.res) {
                        var C = t.res / w;
                        l.scale(C, C)
                    }
                    p = m = 0
                }
                if (Gn.image(l, e, p, m, _, v),
                this.layer.options.debug) {
                    var b = this.layer.options.debugOutline;
                    l.save(),
                    l.strokeStyle = b,
                    l.fillStyle = b,
                    l.strokeWidth = 10,
                    l.font = "20px monospace";
                    var P = new dt(p,m);
                    Gn.rectangle(l, P, {
                        width: _,
                        height: v
                    }, 1, 0),
                    Gn.fillText(l, this.getDebugInfo(s), P._add(32, v - 14), b),
                    Gn.drawCross(l, p + _ / 2, m + v / 2, 2, b),
                    l.restore()
                }
                d && l.restore(),
                l.globalAlpha !== g && (l.globalAlpha = g),
                this.setCanvasUpdated()
            }
        }
        ,
        e.getDebugInfo = function(t) {
            var e = t.split("_")
              , i = e.length;
            return e[i - 3] + "/" + e[i - 2] + "/" + e[i - 1]
        }
        ,
        e.findChildTiles = function(t) {
            return this._findChildTiles(t)
        }
        ,
        e._findChildTiles = function(t) {
            var e = this._getLayerOfTile(t.layer)
              , i = e && e.options.terrainTileMode && e._isPyramidMode();
            if (!e || !e.options.background && !i || t.z > this.layer.getMaxZoom())
                return gd;
            var n = this.getMap()
              , r = [];
            if (e._isPyramidMode()) {
                if (!i) {
                    for (var o = this._getLayerOfTile(t.layer), s = 2 * t.x, a = 2 * t.y, h = t.z + 1, l = [], u = 0; u < 2; u++)
                        for (var c = 0; c < 2; c++)
                            l.push(s + u, a + c, h);
                    for (; l.length; ) {
                        var d = l.pop()
                          , f = l.pop()
                          , g = l.pop()
                          , p = o._getTileId(g, f, d, t.layer)
                          , m = d + 1 <= t.z + 2
                          , _ = this.tileCache.getAndRemove(p);
                        if (_) {
                            if (this.isValidCachedTile(_))
                                r.push(_),
                                this.tileCache.add(p, _);
                            else if (m)
                                for (var v = 0; v < 2; v++)
                                    for (var y = 0; y < 2; y++)
                                        l.push(2 * g + v, 2 * f + y, d + 1)
                        } else if (m)
                            for (var x = 0; x < 2; x++)
                                for (var w = 0; w < 2; w++)
                                    l.push(2 * g + x, 2 * f + w, d + 1)
                    }
                    return r
                }
                var C;
                i && (C = []);
                for (var b = 2 * t.x, P = 2 * t.y, M = t.z + 1, T = [], S = 0; S < 2; S++)
                    for (var E = 0; E < 2; E++) {
                        var R = b + S
                          , A = P + E
                          , k = M
                          , O = e._getTileId(R, A, k, t.layer)
                          , L = this.tileCache.getAndRemove(O);
                        L && this.isValidCachedTile(L) ? (r.push(L),
                        this.tileCache.add(O, L),
                        T.push(null)) : T.push(O)
                    }
                if (r.length < 4)
                    for (var D = 0, I = 0; I < 2; I++)
                        for (var z = 0; z < 2; z++) {
                            var j = T[D++];
                            if (j) {
                                for (var F = b + I, G = P + z, H = M, B = r.length, N = [], Z = 0; Z < 2; Z++)
                                    for (var W = 0; W < 2; W++) {
                                        var V = 2 * F + Z
                                          , U = 2 * G + W
                                          , J = H + 1
                                          , q = e._getTileId(V, U, J, t.layer)
                                          , X = this.tileCache.getAndRemove(q);
                                        X && this.isValidCachedTile(X) ? (r.push(X),
                                        this.tileCache.add(q, X),
                                        N.push(null)) : N.push(q)
                                    }
                                if (i && r.length - B < 4) {
                                    var Y = e.tileInfoCache.get(j) || e._createChildNode(t, I, z, [0, 0], j);
                                    if (r.length - B == 0)
                                        C.push(Y);
                                    else
                                        for (var Q = 0, K = 0; K < 2; K++)
                                            for (var $ = 0; $ < 2; $++) {
                                                var tt = N[Q++];
                                                if (tt) {
                                                    var et = this.layer.tileInfoCache.get(tt) || e._createChildNode(Y, K, $, [0, 0], tt);
                                                    C.push(et)
                                                }
                                            }
                                }
                            }
                        }
                return i ? {
                    tiles: r,
                    missedTiles: C
                } : r
            }
            for (var it = t.res, nt = t.extent2d.getMin(), rt = t.extent2d.getMax(), ot = e._project(n._pointToPrjAtRes(nt, it, dd), dd), st = e._project(n._pointToPrjAtRes(rt, it, fd), fd), at = 1; at < 1; at++)
                this._findChildTilesAt(r, ot, st, e, t.z + at);
            return r
        }
        ,
        e._findChildTilesAt = function(t, e, i, n, r) {
            var o = n.getId()
              , s = n.getSpatialReference().getResolution(r);
            if (s)
                for (var a, h, l = n._getTileConfig().getTileIndex(e, s), u = n._getTileConfig().getTileIndex(i, s), c = Math.min(l.idx, u.idx), d = Math.max(l.idx, u.idx), f = Math.min(l.idy, u.idy), g = Math.max(l.idy, u.idy), p = c; p < d; p++)
                    for (var m = f; m < g; m++)
                        a = n._getTileId(p, m, r, o),
                        (h = this.tileCache.getAndRemove(a)) && this.isValidCachedTile(h) && (t.push(h),
                        this.tileCache.add(a, h))
        }
        ,
        e.findParentTile = function(t, e) {
            return this._findParentTile(t, e)
        }
        ,
        e._findParentTile = function(t, e) {
            var i = this.getMap()
              , n = this._getLayerOfTile(t.layer);
            if (!n || !n.options.background && !n.options.terrainTileMode)
                return null;
            var r = n.getMinZoom()
              , o = e || t.z - r;
            if (n._isPyramidMode()) {
                for (var s = t.z - o, a = t.z - 1; s <= a; a--) {
                    var h = t.z - a
                      , l = Math.pow(2, h)
                      , u = Math.floor(t.x / l)
                      , c = Math.floor(t.y / l)
                      , d = void 0;
                    d = a === t.z - 1 ? t.parent : n._getTileId(u, c, a, t.layer);
                    var f = this.tileCache.getAndRemove(d);
                    if (f && this.isValidCachedTile(f))
                        return this.tileCache.add(d, f),
                        f
                }
                return null
            }
            for (var g = n.getSpatialReference(), p = g.getZoomDirection(), m = t.res, _ = t.extent2d.getCenter(), v = n._project(i._pointToPrjAtRes(_, m)), y = 1; y <= o; y++) {
                var x = t.z - p * y
                  , w = g.getResolution(x);
                if (w) {
                    var C = n._getTileConfig().getTileIndex(v, w)
                      , b = n._getTileId(C.x, C.y, x, t.layer)
                      , P = this.tileCache.getAndRemove(b);
                    if (P)
                        return this.tileCache.add(b, P),
                        P
                }
            }
            return null
        }
        ,
        e.isValidCachedTile = function(t) {
            return !!t.image
        }
        ,
        e.isTileComplete = function() {
            return !0
        }
        ,
        e._getLayerOfTile = function(t) {
            return this.layer.getChildLayer ? this.layer.getChildLayer(t) : this.layer
        }
        ,
        e.getCachedTile = function(t, e) {
            var i = t.id
              , n = this.tilesInView
              , r = this.tileCache.getAndRemove(i);
            if (r) {
                e || (n[i] = r);
                var o = this.tilesLoading;
                if (o && o[i]) {
                    this.markCurrent(o[i], !1);
                    var s = o[i]
                      , a = s.image
                      , h = s.info;
                    this.abortTileLoading(a, h),
                    delete o[i]
                }
            } else
                r = n[i];
            return r && (r.current = !0,
            this.isValidCachedTile(r) && this.tileCache.add(i, r)),
            r
        }
        ,
        e._addTileToCache = function(t, e) {
            this.isValidCachedTile({
                info: t,
                image: e
            }) && (this.tilesInView[t.id] = {
                image: e,
                current: !0,
                info: t
            })
        }
        ,
        e.getTileOpacity = function(t, e) {
            var i = this._getTileFadingOpacity(t);
            if (this.layer.getChildLayer) {
                var n = this.layer.getLayer(e.layer);
                n && (i *= n.options.opacity)
            }
            return i
        }
        ,
        e._getTileFadingOpacity = function(t) {
            return this.layer.options.fadeAnimation && t.loadTime ? Math.min(1, (x() - t.loadTime) / this.layer.options.fadeDuration) : 1
        }
        ,
        e.onRemove = function() {
            this.clear(),
            delete this.tileCache,
            delete this._tilePlaceHolder,
            delete this._tileZoom,
            n.prototype.onRemove.call(this)
        }
        ,
        e.markCurrent = function(t, e) {
            t.current = e
        }
        ,
        e.markTiles = function() {
            var t = 0
              , e = 0;
            if (this.tilesLoading)
                for (var i in this.tilesLoading)
                    this.markCurrent(this.tilesLoading[i], !1),
                    t++;
            if (this.tilesInView)
                for (var n in this.tilesInView)
                    this.markCurrent(this.tilesInView[n], !1),
                    e++;
            return [t, e]
        }
        ,
        e.retireTiles = function(t) {
            for (var e in this.tilesLoading) {
                var i = this.tilesLoading[e];
                !t && i.current || (i.image && this.abortTileLoading(i.image, i.info),
                this.deleteTile(i),
                this.removeTileLoading(i.info))
            }
            for (var n in this.tilesInView) {
                var r = this.tilesInView[n];
                r.current || (delete this.tilesInView[n],
                this.tileCache.has(n) || this.deleteTile(r))
            }
        }
        ,
        e.deleteTile = function(t) {
            if (t && t.image) {
                var e = t.info.id;
                this._tileQueueIds.has(e) && this._tileQueueIds.delete(e),
                t.image.close && t.image.close(),
                t.image instanceof Image && (t.image.onload = null,
                t.image.onerror = null)
            }
        }
        ,
        e._generatePlaceHolder = function(t) {
            var e = this.getMap()
              , i = this.layer.options.placeholder;
            if (!i || e.getPitch())
                return null;
            var n = this.layer.getTileSize()
              , r = t / e._getResolution()
              , o = this._tilePlaceHolder = this._tilePlaceHolder || Gn.createCanvas(1, 1, e.CanvasClass);
            return o.width = n.width * r,
            o.height = n.height * r,
            H(i) ? i(o) : function(t) {
                var e = t.getContext("2d")
                  , i = t.width
                  , n = t.height
                  , r = i / 16
                  , o = n / 16;
                e.beginPath();
                for (var s = 0; s < 16; s++)
                    e.moveTo(0, s * o),
                    e.lineTo(i, s * o),
                    e.moveTo(s * r, 0),
                    e.lineTo(s * r, n);
                e.strokeStyle = "rgba(180, 180, 180, 0.1)",
                e.lineWidth = 1,
                e.stroke(),
                e.beginPath();
                for (var a = [[0, 0], [i, 0], [0, n], [i, n], [0, 0], [0, n], [i, 0], [i, n], [0, n / 2], [i, n / 2], [i / 2, 0], [i / 2, n]], h = 1; h < a.length; h += 2)
                    e.moveTo(a[h - 1][0], a[h - 1][1]),
                    e.lineTo(a[h][0], a[h][1]);
                e.lineWidth = 4,
                e.stroke()
            }(o),
            o
        }
        ,
        e.setTerrainHelper = function(t) {
            this._terrainHelper = t
        }
        ,
        t
    }(Io);
    function _d() {
        return !1
    }
    mc.registerRenderer("canvas", md);
    var vd = new dt(0,0)
      , yd = {
        properties: {}
    }
      , xd = function(_) {
        function t() {
            return _.apply(this, arguments) || this
        }
        it(t, _);
        var e = t.prototype;
        return e.isDrawable = function() {
            return !0
        }
        ,
        e.needToRedraw = function() {
            var t = this.getMap();
            return !(!this.isGL() || t.getPitch() || !t.isZooming() || t.isMoving() || t.isRotating()) || _.prototype.needToRedraw.call(this)
        }
        ,
        e.onDrawTileStart = function(t, e) {
            var i = this.gl;
            i.enable(i.DEPTH_TEST),
            i.depthFunc(i.LEQUAL),
            i.enable(i.POLYGON_OFFSET_FILL),
            i.enable(i.STENCIL_TEST),
            i.stencilOp(i.KEEP, i.KEEP, i.REPLACE);
            var n = !!this.layer.options.depthMask;
            if (i.depthMask(n),
            e && e.renderTarget) {
                var r = e.renderTarget.fbo;
                if (r) {
                    var o = e.renderTarget.getFramebuffer(r);
                    i.bindFramebuffer(i.FRAMEBUFFER, o)
                }
            }
        }
        ,
        e.onDrawTileEnd = function(t, e) {
            var i = this.gl;
            e && e.renderTarget && (e.renderTarget.fbo && i.bindFramebuffer(i.FRAMEBUFFER, null))
        }
        ,
        e.drawTile = function(t, e, i) {
            if (!i || !i.sceneFilter || i.sceneFilter(yd)) {
                var n = this.getMap();
                if (t && n && e) {
                    var r = t._glScale = t._glScale || t.res / n.getGLRes()
                      , o = t.extent2d.xmax - t.extent2d.xmin
                      , s = t.extent2d.ymax - t.extent2d.ymin;
                    if (!1 !== t.cache && this._bindGLBuffer(e, o, s),
                    this.isGL()) {
                        var a = t.extent2d
                          , h = t.offset
                          , l = vd.set(a.xmin - h[0], t.extent2d.ymax - h[1])
                          , u = l.x * r
                          , c = l.y * r
                          , d = this.getTileOpacity(e, t)
                          , f = null;
                        this.layer.options.debug && (f = this.getDebugInfo(t.id));
                        var g = this.gl;
                        g.stencilFunc(g.LEQUAL, Math.abs(this.getCurrentTileZoom() - t.z), 255);
                        var p = this.layer.getPolygonOffset()
                          , m = this.drawingCurrentTiles ? p : p + 1;
                        g.polygonOffset(m, m),
                        this.drawGLImage(e, u, c, o, s, r, d, f),
                        this._getTileFadingOpacity(e) < 1 ? this.setToRedraw() : this.setCanvasUpdated()
                    } else
                        _.prototype.drawTile.call(this, t, e)
                }
            }
        }
        ,
        e._bindGLBuffer = function(t, e, i) {
            t.glBuffer || (t.glBuffer = this.bufferTileData(0, 0, e, i))
        }
        ,
        e.loadTileImage = function(t, e) {
            var i = this.layer.options.crossOrigin;
            t.crossOrigin = null !== i ? i : "",
            t.src = e
        }
        ,
        e.onCanvasCreate = function() {
            this.canvas.gl && this.canvas.gl.wrap || this.createCanvas2()
        }
        ,
        e.createContext = function() {
            _.prototype.createContext.call(this),
            this.createGLContext()
        }
        ,
        e.resizeCanvas = function(t) {
            this.canvas && (_.prototype.resizeCanvas.call(this, t),
            this.resizeGLCanvas())
        }
        ,
        e.clearCanvas = function() {
            this.canvas && (_.prototype.clearCanvas.call(this),
            this.clearGLCanvas())
        }
        ,
        e.getCanvasImage = function() {
            if (!this.isGL() || !this.canvas2)
                return _.prototype.getCanvasImage.call(this);
            var t = _.prototype.getCanvasImage.call(this);
            return t && (t.image = this.canvas2),
            t
        }
        ,
        e.isGL = function() {
            if (this.canvas.gl && this.canvas.gl.wrap)
                return !0;
            var t = this.getMap();
            return t && (t.getPitch() || t.getBearing()) || this.layer && !!this.layer.options.fragmentShader
        }
        ,
        e.deleteTile = function(t) {
            _.prototype.deleteTile.call(this, t),
            t && t.image && this.disposeImage(t.image),
            delete t.image
        }
        ,
        e.onRemove = function() {
            _.prototype.onRemove.call(this),
            this.removeGLCanvas()
        }
        ,
        t
    }(Fc(md));
    function wd(e) {
        var t = this.layer.getTileSize()
          , i = this.canvas.constructor
          , n = this.getMap()
          , r = n.getDevicePixelRatio()
          , o = Gn.createCanvas(t.width * r, t.height * r, i);
        o.layer = this.layer;
        var s = this
          , a = new dt(e.extent2d.xmin,e.extent2d.ymax)
          , h = new Zr(n.pointToCoordinate(a),n.pointToCoordinate(a.add(t.width, t.height)),n.getProjection());
        return this.layer.drawTile(o, {
            url: e.url,
            point: a,
            center: n.pointToCoordinate(a.add(t.width / 2, t.height / 2)),
            extent: h,
            z: e.z,
            x: e.x,
            y: e.y
        }, function(t) {
            t ? s.onTileError(o, e) : s.onTileLoad(o, e)
        }),
        o
    }
    mc.registerRenderer("gl", xd);
    var Cd = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        return it(e, t),
        e.prototype.loadTile = function() {
            return wd.apply(this, arguments)
        }
        ,
        e
    }(md)
      , bd = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        return it(e, t),
        e.prototype.loadTile = function() {
            return wd.apply(this, arguments)
        }
        ,
        e
    }(xd);
    Tc.registerRenderer("canvas", Cd),
    Tc.registerRenderer("gl", bd);
    var Pd = "undefined" != typeof Int8Array ? new Int8Array([-1, 1, 0, -1, -1, 0, 1, 1, 0, 1, -1, 0]) : []
      , Md = function() {
        function t(t, e, i) {
            this.gl = t,
            this.quadVertices = e || Pd,
            this.attributes = ["a_position", 3, function(t) {
                {
                    if (t instanceof Float32Array)
                        return "FLOAT";
                    if (t instanceof Int16Array)
                        return "SHORT";
                    if (t instanceof Uint16Array)
                        return "UNSIGNED_SHORT";
                    if (t instanceof Int8Array)
                        return "BYTE";
                    if (t instanceof Uint8Array || t instanceof Uint8ClampedArray)
                        return "UNSIGNED_BYTE"
                }
                return "FLOAT"
            }(e)],
            this.debug = i
        }
        var e = t.prototype;
        return e.start = function() {
            var t = this.gl;
            t.enable(t.STENCIL_TEST),
            t.stencilMask(255),
            t.stencilOp(t.KEEP, t.REPLACE, t.REPLACE),
            t.depthMask(!1),
            this._save(),
            this.buffer || (this._createBuffer(),
            this._createProgram()),
            t.useProgram(this.program),
            t.bindBuffer(t.ARRAY_BUFFER, this.buffer),
            Rc(t, this.program, this.attributes),
            this.transformLoc || (this.transformLoc = t.getUniformLocation(this.program, "transform")),
            this.colorLoc || (this.colorLoc = t.getUniformLocation(this.program, "color")),
            this.debug || t.colorMask(!1, !1, !1, !1)
        }
        ,
        e.end = function() {
            var t = this.gl;
            t.depthMask(!0),
            this._restore(),
            this.debug || t.colorMask(!0, !0, !0, !0)
        }
        ,
        e.draw = function(t) {
            var e = this.gl;
            e.uniformMatrix4fv(this.transformLoc, !1, t),
            e.uniform3fv(this.colorLoc, [Math.random(), Math.random(), Math.random()]),
            e.drawArrays(e.TRIANGLE_STRIP, 0, 4)
        }
        ,
        e.remove = function() {
            var t = this.gl;
            return this.buffer && t.deleteBuffer(this.buffer),
            this.program && (t.deleteShader(this.program.fragmentShader),
            t.deleteShader(this.program.vertexShader),
            t.deleteProgram(this.program)),
            delete this.transformLoc,
            delete this.gl,
            this
        }
        ,
        e.stencilMask = function(t) {
            return this.gl.stencilMask(t),
            this
        }
        ,
        e.stencilFunc = function(t, e, i) {
            return this.ref = e,
            this.gl.stencilFunc(t, e, i),
            this
        }
        ,
        e.stencilOp = function(t, e, i) {
            return this.gl.stencilOp(t, e, i),
            this
        }
        ,
        e.resetFunc = function() {
            return this.ref = 1,
            this.gl.stencilFunc(this.gl.ALWAYS, 1, 255),
            this
        }
        ,
        e._save = function() {
            var t = this.gl;
            this._savedProgram = t.program
        }
        ,
        e._restore = function() {
            var t = this.gl;
            t.program = this._savedProgram,
            t.program && t.useProgram(t.program)
        }
        ,
        e._createBuffer = function() {
            var t = this.gl;
            if (this.buffer = t.createBuffer(),
            !this.buffer)
                throw new Error("Failed to create the buffer object");
            t.bindBuffer(t.ARRAY_BUFFER, this.buffer),
            t.bufferData(t.ARRAY_BUFFER, this.quadVertices, t.STATIC_DRAW)
        }
        ,
        e._createProgram = function() {
            var t = Ec(this.gl, "\n    attribute vec3 a_position;\n    uniform mat4 transform;\n\n    void main()\n    {\n        gl_Position = transform * vec4(a_position, 1.0);\n    }\n", "\n    precision mediump float;\n    uniform vec3 color;\n    void main()\n    {\n        gl_FragColor = vec4(color, 1.0);\n    }\n")
              , e = t.program
              , i = t.vertexShader
              , n = t.fragmentShader;
            e.vertexShader = i,
            e.fragmentShader = n,
            this.program = e
        }
        ,
        t
    }();
    var Td = function(t) {
        function e() {
            return t.apply(this, arguments) || this
        }
        it(e, t);
        var i = e.prototype;
        return i.checkResources = function() {
            var t = this._geosToCheck || [];
            if (!this._resourceChecked && this.layer._geoList && yt(t, this.layer._geoList),
            !St(t))
                return [];
            for (var e = [], i = {}, n = t.length - 1; 0 <= n; n--) {
                var r = t[n]._getExternalResources();
                if (r.length)
                    if (this.resources)
                        for (var o = 0; o < r.length; o++) {
                            var s = r[o][0];
                            this.resources.isResourceLoaded(r[o]) || i[s] || (e.push(r[o]),
                            i[s] = 1)
                        }
                    else
                        e.push.apply(e, r)
            }
            return this._resourceChecked = !0,
            delete this._geosToCheck,
            e
        }
        ,
        i.render = function() {
            return this.layer._sortGeometries(),
            t.prototype.render.apply(this, arguments)
        }
        ,
        i._addGeoToCheckRes = function(t) {
            t && (Array.isArray(t) || (t = [t]),
            this._geosToCheck || (this._geosToCheck = []),
            yt(this._geosToCheck, t))
        }
        ,
        i.onGeometryAdd = function(t) {
            this._addGeoToCheckRes(t),
            Sd(this)
        }
        ,
        i.onGeometryRemove = function() {
            Sd(this)
        }
        ,
        i.onGeometrySymbolChange = function(t) {
            this._addGeoToCheckRes(t.target),
            Sd(this)
        }
        ,
        i.onGeometryShapeChange = function() {
            Sd(this)
        }
        ,
        i.onGeometryPositionChange = function() {
            Sd(this)
        }
        ,
        i.onGeometryZIndexChange = function() {
            Sd(this)
        }
        ,
        i.onGeometryShow = function() {
            Sd(this)
        }
        ,
        i.onGeometryHide = function() {
            Sd(this)
        }
        ,
        i.onGeometryPropertiesChange = function() {
            Sd(this)
        }
        ,
        e
    }(Io);
    function Sd(t) {
        t.layer.options.drawImmediate && t.render(),
        t.setToRedraw()
    }
    var Ed = new Vr
      , Rd = []
      , Ad = new Vr
      , kd = new br;
    function Od(t) {
        if (!t)
            return null;
        var e = t.getContext("2d");
        return e.clearRect(0, 0, t.width, t.height),
        e
    }
    function Ld(t) {
        return t && t.options.progressiveRender && t.options.progressiveRenderDebug
    }
    var Dd = function(e) {
        function t() {
            return e.apply(this, arguments) || this
        }
        it(t, e);
        var i = t.prototype;
        return i.setToRedraw = function() {
            return e.prototype.setToRedraw.call(this),
            this._resetProgressiveRender(),
            this
        }
        ,
        i._geoIsCollision = function(t, e) {
            if (!t)
                return !1;
            if (!t.options.collision)
                return !1;
            if (t.isPoint && t.getContainerExtent) {
                t.bbox || (t.bbox = [0, 0, 0, 0]);
                var i = this.layer.options.collisionBufferSize
                  , n = t.getContainerExtent();
                if (!n)
                    return !1;
                if (t.bbox[0] = n.xmin - i,
                t.bbox[1] = n.ymin - i,
                t.bbox[2] = n.xmax + i,
                t.bbox[3] = n.ymax + i,
                e.collides(t.bbox))
                    return !0;
                e.insertBox(t.bbox)
            }
            return !1
        }
        ,
        i.getImageData = function() {
            if (!this._lastRenderTime || x() - this._lastRenderTime < 32)
                return null;
            if (!this.context || !this.context.canvas)
                return null;
            if (!this._imageData) {
                var t = this.context.canvas
                  , e = t.width
                  , i = t.height;
                try {
                    this._imageData = this.context.getImageData(0, 0, e, i)
                } catch (t) {
                    console.warn("hit detect failed with tainted canvas, some geometries have external resources in another domain:\n", t)
                }
            }
            return this._imageData
        }
        ,
        i.clearImageData = function() {
            this._imageData = null,
            delete this._imageData,
            this._lastRenderTime = x()
        }
        ,
        i.checkResources = function() {
            var r = this
              , o = e.prototype.checkResources.apply(this, arguments)
              , t = this.layer.getStyle();
            return t && (Array.isArray(t) || (t = [t]),
            t.forEach(function(t) {
                for (var e = Re(t.symbol, !0), i = 0, n = e.length; i < n; i++)
                    r.resources.isResourceLoaded(e[i]) || o.push(e[i])
            })),
            o
        }
        ,
        i.needToRedraw = function() {
            if (this.isProgressiveRender() && !this.renderEnd)
                return !0;
            var t = this.getMap();
            return !(!t.isInteracting() || !this.layer.options.enableAltitude) || !(t.isZooming() && !t.isRotating() && !t.getPitch() && !this._hasPoint && this.layer.constructor === sl) && e.prototype.needToRedraw.call(this)
        }
        ,
        i.draw = function() {
            if (this.getMap()) {
                if (!this.layer.isVisible() || this.layer.isEmpty())
                    return this.clearCanvas(),
                    void this.completeRender();
                this.prepareCanvas(),
                this.drawGeos(),
                this.completeRender()
            }
        }
        ,
        i.isBlank = function() {
            return !!this.context && (!this.isProgressiveRender() && !this.context.canvas._drawn)
        }
        ,
        i.drawOnInteracting = function() {
            if (this._geosToDraw) {
                this._updateMapStateCache(),
                this._updateDisplayExtent();
                var t = this.getMap()
                  , e = this.layer.getCount()
                  , i = this.mapStateCache.resolution;
                (t.isZooming() && t.options.seamlessZoom && void 0 !== this._drawnRes && i > 1.5 * this._drawnRes && this._geosToDraw.length < e || t.isMoving() || t.isInteracting()) && (this.prepareToDraw(),
                this._batchConversionMarkers(this.mapStateCache.glRes),
                this._onlyHasPoint || this._checkGeos(),
                this._drawnRes = i),
                this._sortByDistanceToCamera(t.cameraPosition);
                var n = this.layer.options
                  , r = n.collision
                  , o = n.collisionDelay;
                if (r) {
                    var s = x();
                    this._lastCollisionTime || (this._lastCollisionTime = s),
                    s - this._lastCollisionTime <= o ? this._geosToDraw = this._lastGeosToDraw || this._geosToDraw : (this._collidesGeos(),
                    this._lastCollisionTime = s)
                }
                for (var a = 0, h = this._geosToDraw.length; a < h; a++) {
                    var l = this._geosToDraw[a];
                    l._isCheck || l.isVisible() ? (l._paint(this._displayExtent),
                    this._geosToDraw[a]._cPoint = void 0,
                    this._geosToDraw[a]._inCurrentView = void 0) : (delete l._cPoint,
                    delete l._inCurrentView)
                }
                this.clearImageData(),
                this._lastGeosToDraw = this._geosToDraw,
                Ld(this.layer) && console.log("progressiveRender on drawOnInteracting page:", this.page)
            }
        }
        ,
        i.show = function() {
            this.layer.forEach(function(t) {
                t._repaint()
            }),
            e.prototype.show.apply(this, arguments)
        }
        ,
        i.forEachGeo = function(t, e) {
            this.layer.forEach(t, e)
        }
        ,
        i._checkGeos = function() {
            for (var t = this._getCurrentNeedRenderGeos(), e = 0, i = t.length; e < i; e++)
                this.checkGeo(t[e]);
            return this
        }
        ,
        i.drawGeos = function() {
            this._drawSnapshot(),
            this._updateMapStateCache(),
            this._drawnRes = this.mapStateCache.resolution,
            this._updateDisplayExtent(),
            this.prepareToDraw(),
            this._batchConversionMarkers(this.mapStateCache.glRes),
            this._onlyHasPoint || this._checkGeos(),
            this._sortByDistanceToCamera(this.getMap().cameraPosition),
            this._collidesGeos();
            for (var t = 0, e = this._geosToDraw.length; t < e; t++)
                this._geosToDraw[t]._paint(),
                this._geosToDraw[t]._cPoint = void 0,
                this._geosToDraw[t]._inCurrentView = void 0;
            this.clearImageData(),
            this._lastGeosToDraw = this._geosToDraw,
            Ld(this.layer) && console.log("progressiveRender drawGeos page:", this.page),
            this._snapshot(),
            this._setDrawGeosDrawTime()
        }
        ,
        i.prepareToDraw = function() {
            return this.layer._drawTime = x(),
            this._hasPoint = !1,
            this._geosToDraw = [],
            this
        }
        ,
        i._setDrawGeosDrawTime = function() {
            for (var t = x(), e = this.layer._drawTime, i = this.getGeoPainterList(), n = 0, r = i.length; n < r; n++) {
                var o = i[n];
                o && o._setDrawTime && o._setDrawTime(e)
            }
            return Ld(this.layer) && console.log("_setDrawGeosDrawTime time:", x() - t + "ms"),
            this
        }
        ,
        i.checkGeo = function(t) {
            if (t.isPoint && void 0 !== this._onlyHasPoint)
                t._inCurrentView && (this._hasPoint = !0,
                t._isCheck = !0,
                this._geosToDraw.push(t));
            else if (t._isCheck = !1,
            t && t.isVisible() && t.getMap() && t.getLayer() && t.getLayer().isCanvasRender()) {
                var e = t._getPainter()
                  , i = !0;
                if (t._inCurrentView)
                    i = !0;
                else if (!1 === t._inCurrentView)
                    i = !1;
                else {
                    var n = e.get2DExtent(this.resources, Ed);
                    n && n.intersects(this._displayExtent) || (i = !1)
                }
                i && (e.hasPoint() && (this._hasPoint = !0),
                t._isCheck = !0,
                this._geosToDraw.push(t))
            }
        }
        ,
        i._collidesGeos = function() {
            if (!this.layer.options.collision)
                return this;
            var t = this.layer.options.collisionScope
              , e = this.layer.getMap()
              , i = "map" === t ? e.getCollisionIndex() : kd;
            i === kd && i.clear();
            var n = this._geosToDraw;
            this._geosToDraw = [];
            for (var r = 0, o = n.length; r < o; r++)
                this._geoIsCollision(n[r], i) || this._geosToDraw.push(n[r]);
            return this
        }
        ,
        i.onZoomEnd = function() {
            delete this.canvasExtent2D,
            e.prototype.onZoomEnd.apply(this, arguments)
        }
        ,
        i.onRemove = function() {
            this.forEachGeo(function(t) {
                t.onHide()
            }),
            delete this._geosToDraw,
            delete this.snapshotCanvas,
            delete this.pageGeos,
            delete this.geoPainterList
        }
        ,
        i.onGeometryPropertiesChange = function(t) {
            t && this.layer._styleGeometry(t.target),
            e.prototype.onGeometryPropertiesChange.call(this, t)
        }
        ,
        i._updateDisplayExtent = function() {
            var t = this.canvasExtent2D;
            if (this._maskExtent) {
                if (!this._maskExtent.intersects(t))
                    return void this.completeRender();
                t = t.intersection(this._maskExtent)
            }
            this._displayExtent = t
        }
        ,
        i.identifyAtPoint = function(t, e) {
            void 0 === e && (e = {});
            var i = this.getGeosForIdentify();
            return i ? this.layer._hitGeos(i, t, e) : []
        }
        ,
        i._updateMapStateCache = function() {
            var t = this.getMap()
              , e = t._pointToContainerPoint(this.middleWest)._add(0, -t.height / 2)
              , i = t.getResolution()
              , n = t.getPitch()
              , r = t.getBearing()
              , o = t.getGLScale()
              , s = t.getGLRes()
              , a = t.getContainerExtent()
              , h = t._get2DExtent()
              , l = t._get2DExtentAtRes(s);
            return this.mapStateCache = {
                resolution: i,
                pitch: n,
                bearing: r,
                glScale: o,
                glRes: s,
                _2DExtent: h,
                glExtent: l,
                containerExtent: a,
                offset: e
            },
            this
        }
        ,
        i._batchConversionMarkers = function(t) {
            if (this._onlyHasPoint = void 0,
            !this._constructorIsThis())
                return [];
            var e = []
              , i = []
              , n = []
              , r = {}
              , o = this.layer
              , s = o.options
              , a = o.getAltitude ? o.getAltitude() : 0
              , h = o.isCanvasRender();
            this._onlyHasPoint = !0;
            for (var l = 0, u = this._getCurrentNeedRenderGeos(), c = 0, d = u.length; c < d; c++) {
                var f = u[c];
                if (f.isPoint) {
                    var g = f._painter;
                    g || (g = f._getPainter());
                    var p = g.getRenderPoints("center")[0][0]
                      , m = s.enableAltitude ? f._getAltitude() : a;
                    void 0 === r[m] && (r[m] = g.getAltitude()),
                    e[l] = p,
                    n[l] = r[m],
                    i[l] = f,
                    l++
                } else
                    this._onlyHasPoint = !1
            }
            if (0 === l)
                return [];
            var _ = this.getMap()
              , v = Bt(e, "_pt");
            v = _._pointsAtResToContainerPoints(e, t, n, v);
            for (var y = _.getContainerExtent(), x = y.xmax, w = y.ymax, C = y.xmin, b = y.ymin, P = {}, M = 0, T = i.length; M < T; M++) {
                var S = i[M];
                if (S._cPoint = v[M],
                S._cPoint) {
                    var E = v[M]
                      , R = E.x
                      , A = E.y;
                    if (S._inCurrentView = C <= R && b <= A && R <= x && A <= w,
                    !S._inCurrentView) {
                        var k = S.getSymbolHash()
                          , O = void 0;
                        O = k ? P[k] = P[k] || S._painter.getFixedExtent() : S._painter.getFixedExtent(),
                        Ad.set(O.xmin, O.ymin, O.xmax, O.ymax),
                        Ad._add(v[M]),
                        S._inCurrentView = Ad.intersects(y)
                    }
                    S._inCurrentView && (S.isVisible() && h || (S._inCurrentView = !1),
                    this._onlyHasPoint && S._inCurrentView && (this._hasPoint = !0,
                    S._isCheck = !0,
                    this._geosToDraw.push(S)))
                } else
                    S._inCurrentView = !1
            }
            return v
        }
        ,
        i._sortByDistanceToCamera = function(l) {
            if (this.layer.options.sortByDistanceToCamera && this._geosToDraw.length) {
                var t = this.getMap()
                  , u = t.distanceToPoint(1e3, 0, t.getGLScale()).x / 1e3;
                this._geosToDraw.sort(function(t, e) {
                    if (!t.isPoint || !e.isPoint)
                        return 0;
                    var i = t._painter
                      , n = e._painter;
                    if (!i || !n)
                        return 0;
                    var r = i.getRenderPoints("center")[0][0]
                      , o = n.getRenderPoints("center")[0][0]
                      , s = i.getAltitude() * u
                      , a = n.getAltitude() * u;
                    Ml(Rd, r.x, r.y, s);
                    var h = kl(Rd, l);
                    return Ml(Rd, o.x, o.y, a),
                    kl(Rd, l) - h
                })
            }
        }
        ,
        i._constructorIsThis = function() {
            return this.constructor === t
        }
        ,
        i.isProgressiveRender = function() {
            var t = this.layer;
            if (!t)
                return !1;
            var e = t.options || {}
              , i = e.progressiveRender;
            return !e.collision && i
        }
        ,
        i.getGeosForIdentify = function() {
            return this.isProgressiveRender() ? this.pageGeos || [] : this._geosToDraw || []
        }
        ,
        i.getGeoPainterList = function() {
            if (!this.isProgressiveRender()) {
                for (var t = [], e = this._geosToDraw || [], i = 0, n = e.length; i < n; i++)
                    t.push(e[i]._painter);
                return t
            }
            return this.geoPainterList || []
        }
        ,
        i._checkSnapshotCanvas = function() {
            if (!this.isProgressiveRender())
                return delete this.snapshotCanvas,
                null;
            var t = this.canvas;
            if (!t)
                return delete this.snapshotCanvas,
                null;
            this.snapshotCanvas || (this.snapshotCanvas = Gn.createCanvas(1, 1));
            var e = this.snapshotCanvas
              , i = t.width
              , n = t.height
              , r = t.style;
            return e.width === i && e.height === n || (e.width = i,
            e.height = n),
            e.style.width === r.width && e.style.height === r.height || (e.style.width = r.width,
            e.style.height = r.height),
            e
        }
        ,
        i._getCurrentNeedRenderGeos = function() {
            var t = this.layer._geoList || [];
            if (!this.isProgressiveRender())
                return t;
            if (this.renderEnd)
                return [];
            var e = this.layer.options.progressiveRenderCount
              , i = this.page
              , n = (i - 1) * e
              , r = i * e;
            return t.slice(n, r)
        }
        ,
        i._resetProgressiveRender = function() {
            Ld(this.layer) && console.log("progressiveRender resetProgressiveRender"),
            this.renderEnd = !1,
            this.page = 1,
            this.pageGeos = [],
            this.geoPainterList = [],
            this.maxTolerance = 0,
            this._clearSnapshotCanvas()
        }
        ,
        i._clearSnapshotCanvas = function() {
            var t = this._checkSnapshotCanvas();
            t && Od(t)
        }
        ,
        i._snapshot = function() {
            for (var t = this.isProgressiveRender(), e = this._geosToDraw || [], i = 0, n = e.length; i < n; i++) {
                var r = e[i]
                  , o = r._hitTestTolerance() || 0;
                if (this.maxTolerance = Math.max(this.maxTolerance, o),
                t) {
                    this.pageGeos.push(r);
                    var s = r._painter;
                    this.geoPainterList.push(s)
                }
            }
            if (!t)
                return this;
            var a = x()
              , h = this._checkSnapshotCanvas();
            h && this.canvas && Od(h).drawImage(this.canvas, 0, 0);
            var l = this.layer
              , u = l.options.progressiveRenderCount
              , c = l._geoList || []
              , d = Math.ceil(c.length / u);
            return this.renderEnd = this.page >= d,
            this.renderEnd && this._setDrawGeosDrawTime(),
            Ld(this.layer) && console.log("snapshot time:", x() - a + "ms"),
            this.page++,
            this
        }
        ,
        i._drawSnapshot = function() {
            if (!this.isProgressiveRender())
                return this;
            var t = this.snapshotCanvas
              , e = this.context;
            if (!t || !e)
                return this;
            var i = this.getMap();
            if (!i)
                return this;
            var n = i.getDevicePixelRatio() || 1
              , r = 1 / n;
            return e.scale(r, r),
            e.drawImage(t, 0, 0),
            e.scale(n, n),
            this
        }
        ,
        t
    }(Td);
    sl.registerRenderer("canvas", Dd);
    var Id = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this) || this).map = t,
            e._handlerQueue = [],
            e._thisDocVisibilitychange = e._onDocVisibilitychange.bind(at(at(e))),
            e._thisDocDragStart = e._onDocDragStart.bind(at(at(e))),
            e._thisDocDragEnd = e._onDocDragEnd.bind(at(at(e))),
            e._thisDocDPRChange = e._onDocDPRChange.bind(at(at(e))),
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.callInNextFrame = function(t) {
            this._handlerQueue.push(t)
        }
        ,
        e.executeFrameCallbacks = function() {
            var t = this._handlerQueue;
            this._handlerQueue = [];
            for (var e = 0, i = t.length; e < i; e++)
                t[e]()
        }
        ,
        e.offsetPlatform = function(t, e) {
            if (!this.map._panels.front)
                return this;
            if (!e && 0 === t.x && 0 === t.y)
                return this;
            var i = this.map._panels
              , n = this._frontCount = i.back.layerDOM.childElementCount
              , r = this._backCount = i.front.layerDOM.childElementCount
              , o = this._uiCount = i.front.uiDOM.childElementCount;
            if (n || r || o) {
                var s = this.map.offsetPlatform();
                s = t ? s.add(t)._round() : s.round(),
                r && bi(i.back, s),
                (n || o) && bi(i.front, s)
            }
            return this
        }
        ,
        e.domChanged = function() {
            var t = this.map._panels;
            if (!t.front)
                return !1;
            var e = t.back.layerDOM.childElementCount;
            if (void 0 === this._frontCount || this._frontCount !== e)
                return !0;
            var i = t.front.layerDOM.childElementCount;
            if (void 0 === this._backCount || this._backCount !== i)
                return !0;
            var n = t.front.uiDOM.childElementCount;
            return void 0 === this._uiCount || this._uiCount !== n
        }
        ,
        e.resetContainer = function() {
            if (this.map && (this.map._resetMapViewPoint(),
            this.map._panels.front)) {
                var t = new dt(0,0);
                bi(this.map._panels.back, t),
                bi(this.map._panels.front, t)
            }
        }
        ,
        e.onZoomEnd = function() {
            this.resetContainer()
        }
        ,
        e.onLoad = function() {
            this._frameLoop()
        }
        ,
        e._onDocVisibilitychange = function() {
            "visible" === document.visibilityState && this.setToRedraw()
        }
        ,
        e._getWrapPanel = function() {
            if (!this.map)
                return null;
            var t = this.map.getPanels();
            return t && t.mapWrapper
        }
        ,
        e._onDocDragStart = function() {
            var t = this._getWrapPanel();
            t && (t.style.overflow = "visible")
        }
        ,
        e._onDocDragEnd = function() {
            var t = this._getWrapPanel();
            t && (t.style.overflow = "hidden")
        }
        ,
        e._onDocDPRChange = function() {
            var t = this.map;
            t && t.options && !t.options.devicePixelRatio && t.checkSize && t.getRenderer && (t.getRenderer() && t.checkSize(!0))
        }
        ,
        e._containerIsOffscreen = function() {
            var t = this.map.getContainer();
            return !t || !t.style || "none" === t.style.display || Math.min(t.clientWidth, t.clientHeight) <= 0
        }
        ,
        t
    }(qn)
      , zd = new br
      , jd = function(i) {
        function t(t) {
            var e;
            return (e = i.call(this, t) || this)._containerIsCanvas = !!t._containerDOM.getContext,
            e._registerEvents(),
            e._loopTime = 0,
            e._resizeEventList = [],
            e._resizeTime = -1 / 0,
            e
        }
        it(t, i);
        var e = t.prototype;
        return e.load = function() {
            this.initContainer()
        }
        ,
        e.renderFrame = function(t) {
            var e = this.map;
            if (!e || !e.options.renderable)
                return !1;
            if (this._handleResizeEventList(t),
            e.options.stopRenderOnOffscreen && this._containerIsOffscreen())
                return !0;
            this._updateDomPosition(t),
            delete this._isViewChanged,
            e._fireEvent("framestart"),
            this.updateMapDOM(),
            e.clearCollisionIndex();
            var i = this._getAllLayerToRender();
            return this.drawLayers(i, t),
            this.drawLayerCanvas(i) && (this.drawTops(),
            this._drawCenterCross(),
            e.options.debugSky && this._debugSky()),
            this._needClear = !1,
            e._fireEvent("frameend"),
            this._recordView(),
            this._mapview = this._getMapView(),
            delete this._spatialRefChanged,
            this._fireLayerLoadEvents(),
            this.executeFrameCallbacks(),
            this._canvasUpdated = !1,
            e.uiCollides(),
            !0
        }
        ,
        e.updateMapDOM = function() {
            var t = this.map;
            if (!t.isZooming()) {
                var e = t._getViewPointFrameOffset();
                e ? t.offsetPlatform(e) : this.domChanged() && this.offsetPlatform(null, !0)
            }
        }
        ,
        e.drawLayers = function(t, e) {
            for (var i = this.map, n = i.isInteracting(), r = [], o = [], s = i.options.fpsOnInteracting || 0, a = 0 === s ? 0 : 1e3 / s, h = this.map.options.layerCanvasLimitOnInteracting, l = t.length, u = i.getBaseLayer(), c = 0, d = 0; d < l; d++) {
                var f = t[d];
                if (f.isVisible()) {
                    var g = f.isCanvasRender();
                    g && r.push(f.getId());
                    var p = f._getRenderer();
                    if (p) {
                        var m = this._checkLayerRedraw(f);
                        g && p.isCanvasUpdated() && (m || o.push(f.getId()),
                        this.setLayerCanvasUpdated());
                        var _ = p.__zoomTransformMatrix;
                        if (delete p.__zoomTransformMatrix,
                        m) {
                            if (n && g) {
                                if (0 < h && h < l - 1 - d && f !== u) {
                                    f._getRenderer().clearCanvas();
                                    continue
                                }
                                c += this._drawCanvasLayerOnInteracting(f, c, a, e)
                            } else
                                n && p.drawOnInteracting ? (p.prepareRender && p.prepareRender(),
                                p.checkAndDraw ? p.checkAndDraw(p.drawOnInteracting, this._eventParam, e) : p.drawOnInteracting(this._eventParam, e)) : (p.render(e),
                                g && _ && p.isLoadingResource() && (p.__zoomTransformMatrix = _));
                            g && (o.push(f.getId()),
                            this.setLayerCanvasUpdated())
                        } else
                            g && n && (i.isZooming() && !i.getPitch() ? (p.prepareRender(),
                            p.__zoomTransformMatrix = this._zoomMatrix) : (i.getPitch() || i.isRotating()) && p.clearCanvas())
                    }
                }
            }
            var v = this._canvasIds || []
              , y = this._updatedIds || [];
            if (this._canvasIds = r,
            this._updatedIds = o,
            !this.isLayerCanvasUpdated()) {
                v.join("---") === r.join("---") && y.join("---") === o.join("---") || this.setLayerCanvasUpdated()
            }
        }
        ,
        e._checkLayerRedraw = function(t) {
            if (this.isSpatialReferenceChanged())
                return !0;
            var e = this.map
              , i = t._getRenderer();
            return t.isCanvasRender() ? i.testIfNeedRedraw() : !(!i.needToRedraw || !i.needToRedraw()) || (e.isInteracting() || this.isViewChanged())
        }
        ,
        e._drawCanvasLayerOnInteracting = function(t, e, i, n) {
            var r = this.map
              , o = t._getRenderer()
              , s = o.getDrawTime()
              , a = 0 === i || 0 < i && e + s <= i;
            if (o.mustRenderOnInteracting && o.mustRenderOnInteracting())
                o.render(n);
            else {
                if (o.drawOnInteracting && (t === r.getBaseLayer() || a || r.isZooming() && t.options.forceRenderOnZooming || r.isMoving() && t.options.forceRenderOnMoving || r.isRotating() && t.options.forceRenderOnRotating))
                    return o.prepareRender(),
                    o.prepareCanvas(),
                    o.checkAndDraw ? o.checkAndDraw(o.drawOnInteracting, this._eventParam, n) : o.drawOnInteracting(this._eventParam, n),
                    s;
                !r.isZooming() || r.getPitch() || r.isRotating() ? (r.getPitch() || r.isRotating()) && o.clearCanvas() : (o.prepareRender(),
                o.__zoomTransformMatrix = this._zoomMatrix)
            }
            return o.drawOnInteracting && !a && o.onSkipDrawOnInteracting(this._eventParam, n),
            0
        }
        ,
        e._fireLayerLoadEvents = function() {
            if (this._updatedIds && 0 < this._updatedIds.length) {
                var n = this.map;
                this._updatedIds.reverse().forEach(function(t) {
                    var e = n.getLayer(t);
                    if (e) {
                        var i = e._getRenderer();
                        i && i.isRenderComplete() && e.fire("layerload")
                    }
                })
            }
        }
        ,
        e.isLayerCanvasUpdated = function() {
            return this._canvasUpdated
        }
        ,
        e.setLayerCanvasUpdated = function() {
            this._canvasUpdated = !0
        }
        ,
        e.drawLayerCanvas = function(t) {
            var e = this.map;
            if (!e)
                return !1;
            if (!this.isLayerCanvasUpdated() && !this.isViewChanged() && !1 === this._needClear)
                return !1;
            this.canvas || this.createCanvas(),
            e._fireEvent("renderstart", {
                context: this.context
            }),
            this._updateCanvasSize() || this.clearCanvas();
            for (var i, n = e.isInteracting(), r = e.options.layerCanvasLimitOnInteracting, o = t.length, s = [], a = 0; a < o; a++) {
                if (t[a].isVisible() && t[a].isCanvasRender())
                    if (t[a]._getRenderer()) {
                        var h = this._getLayerImage(t[a]);
                        h && h.image && (t[a] === e.getBaseLayer() ? i = [t[a], h] : s.push([t[a], h]))
                    }
            }
            var l = this.canvas.width
              , u = this.canvas.height;
            i && (this._drawLayerCanvasImage(i[0], i[1], l, u),
            this._drawFog()),
            o = s.length;
            for (var c = n && 0 <= r && r < o ? o - r : 0; c < o; c++)
                this._drawLayerCanvasImage(s[c][0], s[c][1], l, u);
            return e._fireEvent("renderend", {
                context: this.context
            }),
            !0
        }
        ,
        e.setToRedraw = function() {
            var t = this._getAllLayerToRender();
            this._needClear = !0;
            for (var e = 0, i = t.length; e < i; e++) {
                var n = t[e].getRenderer();
                n && n.canvas && n.setToRedraw && n.setToRedraw()
            }
        }
        ,
        e.updateMapSize = function(t) {
            if (t && !this._containerIsCanvas) {
                var e = t.width + "px"
                  , i = t.height + "px"
                  , n = this.map._panels;
                n.mapWrapper.style.width = e,
                n.mapWrapper.style.height = i,
                this._updateCanvasSize()
            }
        }
        ,
        e.getMainPanel = function() {
            return this.map ? this._containerIsCanvas ? this.map._containerDOM : this.map._panels ? this.map._panels.mapWrapper : null : null
        }
        ,
        e.toDataURL = function(t, e) {
            return this.canvas ? this.canvas.toDataURL(t, e) : null
        }
        ,
        e.remove = function() {
            $.webgl && "undefined" != typeof document && (Xn.off(Yn, this._thisDocDPRChange, this),
            Xn.off(Qn, this._thisDocVisibilitychange, this),
            Xn.off(Kn, this._thisDocDragStart, this),
            Xn.off($n, this._thisDocDragEnd, this)),
            this._resizeInterval && clearInterval(this._resizeInterval),
            this._resizeObserver && this._resizeObserver.disconnect(),
            delete this.context,
            delete this.canvas,
            delete this.map,
            delete this._spatialRefChanged,
            this._cancelFrameLoop()
        }
        ,
        e.hitDetect = function(t) {
            var e = this.map;
            if (e && e.options.hitDetect && !e.isInteracting()) {
                var i = e._getLayers()
                  , n = "default"
                  , r = e.options.hitDetectLimit || 0
                  , o = 0;
                t && t._round && t._round();
                for (var s = i.length - 1; 0 <= s; s--) {
                    var a = i[s];
                    if (!(!a.options.hitDetect || a.isEmpty && a.isEmpty()) && a.options.geometryEvents) {
                        var h = a._getRenderer();
                        if (h && h.hitDetect && (!h.isBlank || !h.isBlank())) {
                            if ("default" !== a.options.cursor && h.hitDetect(t)) {
                                n = a.options.cursor || "pointer";
                                break
                            }
                            if (o++,
                            0 < r && r < o)
                                break
                        }
                    }
                }
                e._trySetCursor(n)
            }
        }
        ,
        e._getLayerImage = function(t) {
            var e = t._getRenderer();
            return e.getCanvasImage ? e.getCanvasImage() : null
        }
        ,
        e.initContainer = function() {
            var o = this.map._panels;
            function t(t, e, i, n) {
                var r = gi("div", e);
                return i && (r.style.cssText = i),
                o[t] = r,
                n || Ci(r),
                r
            }
            var e = this.map._containerDOM;
            if (!this._containerIsCanvas) {
                var i = "position:absolute;top:0px;left:0px;"
                  , n = t("mapWrapper", "maptalks-wrapper", "position:absolute;overflow:hidden;", !(e.innerHTML = ""))
                  , r = t("allLayers", "maptalks-all-layers", i + "padding:0px;margin:0px;z-index:0;overflow:visible;", !0)
                  , s = t("backStatic", "maptalks-back-static", i + "z-index:0;", !0)
                  , a = t("back", "maptalks-back", i + "z-index:1;")
                  , h = t("backLayer", "maptalks-back-layer", i)
                  , l = t("canvasContainer", "maptalks-canvas-layer", i + "border:none;z-index:2;")
                  , u = t("frontStatic", "maptalks-front-static", i + "z-index:3;", !0)
                  , c = t("front", "maptalks-front", i + "z-index:4;", !0)
                  , d = t("frontLayer", "maptalks-front-layer", i + "z-index:0;")
                  , f = t("ui", "maptalks-ui", i + "border:none;z-index:1;", !0)
                  , g = t("control", "maptalks-control", "z-index:1", !0);
                e.appendChild(n),
                r.appendChild(s),
                a.appendChild(h),
                a.layerDOM = h,
                r.appendChild(a),
                r.appendChild(l),
                c.appendChild(d),
                c.layerDOM = d,
                c.uiDOM = f,
                r.appendChild(u),
                r.appendChild(c),
                c.appendChild(f),
                n.appendChild(r),
                n.appendChild(g),
                this.createCanvas(),
                this.resetContainer();
                var p = this.map._getContainerDomSize();
                this.updateMapSize(p)
            }
        }
        ,
        e.isViewChanged = function() {
            if (void 0 !== this._isViewChanged)
                return this._isViewChanged;
            var t = this._mapview
              , e = this._getMapView();
            return this._isViewChanged = !t || !Ft(t, e),
            this._isViewChanged
        }
        ,
        e._recordView = function() {
            var t = this.map;
            !t._onViewChange || t.isInteracting() || t.isAnimating() || Ft(t.getView(), t._getCurrentView()) || t._onViewChange(t.getView())
        }
        ,
        e.isSpatialReferenceChanged = function() {
            return this._spatialRefChanged
        }
        ,
        e._getMapView = function() {
            var t = this.map
              , e = t._getPrjCenter();
            return {
                x: e.x,
                y: e.y,
                zoom: t.getZoom(),
                pitch: t.getPitch(),
                bearing: t.getBearing(),
                width: t.width,
                height: t.height
            }
        }
        ,
        e._frameLoop = function(t) {
            var e = this;
            this.map ? (t = t || 0,
            this._frameTimestamp = t,
            this._resizeCount = 0,
            this.renderFrame(t),
            this._animationFrame = ht(function(t) {
                e._frameLoop(t)
            })) : this._cancelFrameLoop()
        }
        ,
        e._cancelFrameLoop = function() {
            this._animationFrame && lt(this._animationFrame)
        }
        ,
        e._drawLayerCanvasImage = function(t, e, i, n) {
            var r = this.context
              , o = e.point.round()
              , s = this.map.getDevicePixelRatio();
            1 !== s && o._multi(s);
            var a = e.image
              , h = a.width
              , l = a.height;
            if (!(o.x + h <= 0 || o.y + l <= 0)) {
                var u = t.options.opacity;
                if (G(u) || (u = 1),
                !(u <= 0)) {
                    var c = e.opacity;
                    if (G(c) || (c = 1),
                    !(c <= 0)) {
                        var d = r.globalAlpha;
                        u < 1 && (r.globalAlpha *= u),
                        c < 1 && (r.globalAlpha *= c),
                        t.options.cssFilter && (r.filter = t.options.cssFilter);
                        var f = t.getRenderer()
                          , g = f.__zoomTransformMatrix
                          , p = f.clipCanvas(this.context);
                        g && (r.save(),
                        r.setTransform.apply(r, g)),
                        r.drawImage(a, 0, 0, h, l, o.x, o.y, i, n),
                        g && r.restore(),
                        p && r.restore(),
                        "none" !== r.filter && (r.filter = "none"),
                        r.globalAlpha = d
                    }
                }
            }
        }
        ,
        e._drawCenterCross = function() {
            var t = this.map.options.centerCross;
            if (t) {
                var e = this.context
                  , i = new dt(this.canvas.width / 2,this.canvas.height / 2);
                H(t) ? t(e, i) : Gn.drawCross(this.context, i.x, i.y, 2, "#f00")
            }
        }
        ,
        e._drawContainerExtent = function() {
            var t = this.map.options.cascadePitches
              , e = this.map.height - this.map._getVisualHeight(t[0])
              , i = this.map.height - this.map._getVisualHeight(t[1])
              , n = this.map.getContainerExtent()
              , r = this.context;
            r.beginPath(),
            r.moveTo(0, n.ymin),
            r.lineTo(n.xmax, n.ymin),
            r.stroke(),
            r.beginPath(),
            r.moveTo(0, e),
            r.lineTo(n.xmax, e),
            r.stroke(),
            r.beginPath(),
            r.moveTo(0, i),
            r.lineTo(n.xmax, i),
            r.stroke()
        }
        ,
        e._drawFog = function() {
            var t = this.map;
            if (!(t.getPitch() <= t.options.maxVisualPitch) && t.options.fog) {
                var e = t.getDevicePixelRatio()
                  , i = this.context
                  , n = t.getContainerExtent()
                  , r = (t.height - t._getVisualHeight(75)) * e;
                r < 0 && (r = 0);
                var o = n.ymin * e
                  , s = Math.ceil(o - r)
                  , a = t.options.fogColor.join()
                  , h = i.createLinearGradient(0, r, 0, o + 30)
                  , l = 1 - 30 / (s + 30);
                h.addColorStop(0, "rgba(" + a + ", 0)"),
                h.addColorStop(.3, "rgba(" + a + ", 0.3)"),
                h.addColorStop(l, "rgba(" + a + ", 1)"),
                h.addColorStop(1, "rgba(" + a + ", 0)"),
                i.beginPath(),
                i.fillStyle = h,
                i.fillRect(0, r, Math.ceil(n.getWidth()) * e, Math.ceil(s + 30))
            }
        }
        ,
        e._debugSky = function() {
            var t = this.map;
            if (!t)
                return this;
            var e = t.getContainerExtent().ymin;
            if (e <= 0)
                return this;
            var i = this.context;
            return i.strokeStyle = "red",
            i.strokeRect(0, 0, t.width, e),
            this
        }
        ,
        e._getAllLayerToRender = function() {
            return this.map._getLayers()
        }
        ,
        e.clearCanvas = function() {
            this.canvas && Gn.clearRect(this.context, 0, 0, this.canvas.width, this.canvas.height)
        }
        ,
        e._updateCanvasSize = function() {
            if (!this.canvas || this._containerIsCanvas)
                return !1;
            var t = this.map
              , e = t.getSize()
              , i = this.canvas
              , n = Ut(e, t.getDevicePixelRatio())
              , r = n.width
              , o = n.height
              , s = n.cssWidth
              , a = n.cssHeight;
            return !i.style || i.style.width === s && i.style.height === a || (i.style.width = s,
            i.style.height = a),
            (r !== i.width || o !== i.height) && (i.height = o,
            i.width = r,
            this.topLayer.width = i.width,
            this.topLayer.height = i.height,
            !0)
        }
        ,
        e.createCanvas = function() {
            this.topLayer = gi("canvas"),
            this.topCtx = this.topLayer.getContext("2d"),
            this._containerIsCanvas ? this.canvas = this.map._containerDOM : (this.canvas = gi("canvas"),
            this._updateCanvasSize(),
            this.map._panels.canvasContainer.appendChild(this.canvas)),
            this.context = this.canvas.getContext("2d")
        }
        ,
        e._updateDomPosition = function(t) {
            return void 0 === this._checkPositionTime && (this._checkPositionTime = -1 / 0),
            500 <= Math.abs(t - this._checkPositionTime) && (Pi(this.map._containerDOM),
            this._checkPositionTime = Math.min(t, this._checkPositionTime)),
            this
        }
        ,
        e._handleResizeEventList = function(t) {
            if (!this._resizeEventList)
                return this;
            var e = this._resizeEventList.length;
            if (0 === e)
                return this;
            if (this._resizeTime && t - this._resizeTime < 60)
                return this;
            var i = this._resizeEventList[e - 1].contentRect;
            return this.map._containerDomContentRect = i,
            this._resizeEventList = [],
            this._checkSize(i),
            this._resizeCount = this._resizeCount || 0,
            this.renderFrame((this._frameTimestamp || 0) + ++this._resizeCount / 100),
            this._resizeTime = t,
            this
        }
        ,
        e._checkSize = function() {
            this.map && this.map.checkSize()
        }
        ,
        e._setCheckSizeInterval = function(t) {
            var e = this;
            $.resizeObserver ? (this._resizeObserver && this._resizeObserver.disconnect(),
            this.map && (this._resizeObserver = new ResizeObserver(function(t) {
                !e.map || e.map.isRemoved() ? e._resizeObserver.disconnect() : t.length && (e._resizeEventList = e._resizeEventList || [],
                e._resizeEventList.push(t[0]))
            }
            ),
            this._resizeObserver.observe(this.map._containerDOM))) : (clearInterval(this._resizeInterval),
            this._checkSizeInterval = t,
            this._resizeInterval = setInterval(function() {
                !e.map || e.map.isRemoved() ? clearInterval(e._resizeInterval) : e._checkSize()
            }, this._checkSizeInterval))
        }
        ,
        e._registerEvents = function() {
            var e = this
              , i = this.map;
            i.options.checkSize && !f && "undefined" != typeof window && this._setCheckSizeInterval(i.options.checkSizeInterval),
            $.mobile || i.on("_mousemove", this._onMapMouseMove, this),
            i.on("_dragrotatestart _dragrotating _dragrotateend _movestart _moving _moveend _zoomstart", function(t) {
                e._eventParam = t
            }),
            i.on("_zooming", function(t) {
                i.getPitch() || (e._zoomMatrix = t.matrix.container),
                e._eventParam = t
            }),
            i.on("_zoomend", function(t) {
                e._eventParam = t,
                delete e._zoomMatrix
            }),
            i.on("_spatialreferencechange", function() {
                e._spatialRefChanged = !0
            }),
            $.webgl && "undefined" != typeof document && (Xn.on(Yn, this._thisDocDPRChange, this),
            Xn.on(Qn, this._thisDocVisibilitychange, this),
            Xn.on(Kn, this._thisDocDragStart, this),
            Xn.on($n, this._thisDocDragEnd, this))
        }
        ,
        e._onMapMouseMove = function(t) {
            var e = this
              , i = this.map;
            !i.isInteracting() && i.options.hitDetect && (this._hitDetectFrame && lt(this._hitDetectFrame),
            this._hitDetectFrame = ht(function() {
                e.hitDetect(t.containerPoint)
            }))
        }
        ,
        e._getCanvasLayers = function() {
            return this.map._getLayers(function(t) {
                return t.isCanvasRender()
            })
        }
        ,
        e.addTopElement = function(t) {
            this._tops || (this._tops = []),
            this._tops.push(t)
        }
        ,
        e.removeTopElement = function(t) {
            if (this._tops) {
                var e = this._tops.indexOf(t);
                0 <= e && this._tops.splice(e, 1)
            }
        }
        ,
        e.getTopElements = function() {
            return this._tops || []
        }
        ,
        e.drawTops = function() {
            this.topCtx.clearRect(0, 0, this.topLayer.width, this.topLayer.height);
            var t = zd;
            t.clear(),
            this.map.fire("drawtopstart"),
            this.map.fire("drawtops");
            for (var e = this.getTopElements(), i = !1, n = this.map.getDevicePixelRatio(), r = [], o = 0; o < e.length; o++) {
                var s = e[o];
                if (s.needCollision && s.needCollision()) {
                    var a = s.getRenderBBOX(n);
                    if (a) {
                        if (t.collides(a)) {
                            var h = s.target && s.target._geometry;
                            h && -1 === r.indexOf(h) && (r.push(h),
                            h.fire("handlecollision"));
                            continue
                        }
                        t.insertBox(a)
                    }
                }
                s.render(this.topCtx) && (i = !0)
            }
            i && this.context.drawImage(this.topLayer, 0, 0),
            this.map.fire("drawtopsend")
        }
        ,
        t
    }(Id);
    Qa.registerRenderer("canvas", jd),
    Qa.mergeOptions({
        fog: !1,
        fogColor: [233, 233, 233]
    });
    var Fd = Object.freeze({
        ResourceCache: zo,
        CanvasRenderer: Io,
        ImageGLRenderable: Fc,
        MapRenderer: Id,
        MapCanvasRenderer: jd,
        Renderable: Ro,
        ImageLayerCanvasRenderer: Vc,
        ImageLayerGLRenderer: Uc,
        TileLayerCanvasRenderer: md,
        TileLayerGLRenderer: xd,
        CanvasTileLayerCanvasRenderer: Cd,
        CanvasTileLayerGLRenderer: bd,
        QuadStencil: Md,
        OverlayLayerCanvasRenderer: Td,
        VectorLayerCanvasRenderer: Dd,
        CanvasLayerRenderer: Jc
    })
      , Gd = {
        _getRenderPoints: function() {
            return [[this._getCenter2DPoint(this.getMap().getGLRes())], null]
        }
    };
    Ch.include(Gd),
    Gh.include(Gd),
    Fh.include(Gd),
    Bh.include(Gd),
    Hh.include({
        _getRenderPoints: function(t) {
            var e = this.getMap()
              , i = e.getGLRes();
            if ("vertex" === t) {
                for (var n = this._trimRing(this.getShell()), r = [], o = 0, s = n.length; o < s; o++)
                    r.push(e.coordToPointAtRes(n[o], i));
                return [r, null]
            }
            return [[e.coordToPointAtRes(this.getCenter(), i)], null]
        }
    });
    var Hd = {
        _getRenderPoints: function(t) {
            var e, i = this.getMap(), n = i.getGLRes(), r = null;
            if ("point" === t)
                (e = this._getPath2DPoints(this._getPrjCoordinates(), !1, n)) && 0 < e.length && Array.isArray(e[0]) && (e = e[0].concat(e[1]));
            else if ("vertex" === t)
                if (r = [],
                (e = this._getPath2DPoints(this._getPrjCoordinates(), !1, n)) && 0 < e.length && Array.isArray(e[0])) {
                    for (var o = 0, s = e.length; o < s; o++)
                        for (var a = 0, h = e[o].length; a < h; a++)
                            0 === a ? r.push([e[o][a], e[o][a + 1]]) : r.push([e[o][a - 1], e[o][a]]);
                    e = e[0].concat(e[1])
                } else
                    for (var l = 0, u = e.length; l < u; l++)
                        0 === l ? r.push([e[l], e[l + 1]]) : r.push([e[l - 1], e[l]]);
            else if ("line" === t) {
                e = [],
                r = [];
                var c = this._getPath2DPoints(this._getPrjCoordinates(), !1, n);
                if (0 < c.length && Array.isArray(c[0]))
                    for (var d, f = 1, g = c.length; f < g; f++) {
                        d = c[f],
                        this instanceof yh && 0 < d.length && !d[0].equals(d[d.length - 1]) && d.push(d[0]);
                        for (var p = 1, m = d.length; p < m; p++)
                            e.push(d[p].add(d[p - 1])._multi(.5)),
                            r.push([d[p - 1], d[p]])
                    }
                else {
                    this instanceof yh && 0 < c.length && !c[0].equals(c[c.length - 1]) && c.push(c[0]);
                    for (var _ = 1, v = c.length; _ < v; _++)
                        e.push(c[_].add(c[_ - 1])._multi(.5)),
                        r.push([c[_ - 1], c[_]])
                }
            } else if ("vertex-first" === t) {
                var y = this._getPrjCoordinates()
                  , x = y.length
                  , w = x ? i._prjToPointAtRes(y[0], n) : null;
                e = x ? [w] : [],
                r = x ? [[w, y[1] ? i._prjToPointAtRes(y[1], n) : w]] : []
            } else if ("vertex-last" === t) {
                var C = this._getPrjCoordinates()
                  , b = C.length
                  , P = b ? i._prjToPointAtRes(C[b - 1], n) : null;
                e = b ? [P] : [];
                var M = 1 < b ? b - 2 : b - 1;
                r = b ? [[C[M] ? i._prjToPointAtRes(C[M], n) : P, P]] : []
            } else {
                var T = this.getCenter();
                if (T) {
                    var S = this._getProjection().project(T);
                    e = [i._prjToPointAtRes(S, n)]
                } else
                    e = []
            }
            return [e, r]
        }
    };
    Ph.include(Hd),
    yh.include(Hd);
    var Bd = {
        within: !1,
        center: [0, 0]
    };
    function Nd(t) {
        if (t && t._containerBbox) {
            Bd.within = !1;
            var e = t._containerBbox
              , i = e.minx
              , n = e.miny
              , r = e.maxx
              , o = e.maxy
              , s = Math.abs(r - i)
              , a = Math.abs(o - n);
            s <= 1 && a <= 1 && (Bd.within = !0,
            Bd.center[0] = (i + r) / 2,
            Bd.center[1] = (n + o) / 2),
            delete t._containerBbox
        } else
            Bd.within = !1;
        return Bd
    }
    function Zd() {
        var t = this._getPrjShell()
          , e = Rn();
        On(t, e);
        var i = e[0]
          , n = e[1]
          , r = e[2]
          , o = e[3];
        return new Zr(i,n,r,o)
    }
    function Wd() {
        var t = this._getPrjShell();
        if (!t || !Array.isArray(t))
            return [];
        var i = this._getProjection()
          , n = this.getCoordinates() || {};
        return t.map(function(t) {
            var e = i.unproject(t);
            return e.z = n.z || 0,
            e
        })
    }
    sa.include({
        _redrawWhenPitch: function() {
            return !1
        },
        _redrawWhenRotate: function() {
            return !1
        },
        _getRenderBBOX: function(t, e) {
            return t.isHitTesting ? null : (kn(An),
            On(e, An),
            An)
        }
    });
    var Vd = {
        _redrawWhenPitch: function() {
            return !0
        },
        _redrawWhenRotate: function() {
            return this instanceof Gh || this instanceof Bh
        },
        _computeRotatedPrjExtent: Zd,
        getRotatedShell: Wd,
        _paintAsPath: function() {
            if (this.isRotated())
                return !0;
            var t = this.getMap();
            return 0 < this._getAltitude() || t.getPitch() || this instanceof Gh && t.getBearing()
        },
        _getPaintParams: function() {
            var t = this.getMap();
            if (this._paintAsPath())
                return yh.prototype._getPaintParams.call(this, !0);
            var e = this._getPrjCoordinates()
              , i = t._prjToPointAtRes(e, t.getGLRes())
              , n = this._getRenderSize(i);
            return [i].concat(n)
        },
        _paintOn: function() {
            return this._paintAsPath() ? Gn.polygon.apply(Gn, arguments) : Gn.ellipse.apply(Gn, arguments)
        },
        _getRenderSize: function(t) {
            var e = this.getMap()
              , i = e.getGLRes()
              , n = this._getPrjExtent()
              , r = e._prjToPointAtRes(n.getMin(), i)
              , o = e._prjToPointAtRes(n.getMax(), i);
            return [Math.abs(o.x - r.x) / 2, Math.abs(o.y - t.y), Math.abs(t.y - r.y)]
        }
    };
    Gh.include(Vd),
    Fh.include(Vd),
    Hh.include({
        _getPaintParams: function() {
            var t = this.getMap()
              , e = this._getPrjShell();
            return [this._getPath2DPoints(e, !1, t.getGLRes())]
        },
        _paintOn: Gn.polygon,
        _computeRotatedPrjExtent: Zd,
        getRotatedShell: Wd
    }),
    Bh.include(Vd, {
        _redrawWhenPitch: function() {
            return !0
        },
        _getPaintParams: function() {
            if (this._paintAsPath())
                return yh.prototype._getPaintParams.call(this, !0);
            var t = this.getMap()
              , e = t._prjToPointAtRes(this._getPrjCoordinates(), t.getGLRes());
            return [e, this._getRenderSize(e)[0], [this.getStartAngle(), this.getEndAngle()]]
        },
        _paintOn: function() {
            if (this._paintAsPath())
                return Gn.polygon.apply(Gn, arguments);
            var t = this.getMap().getBearing()
              , e = arguments;
            return t && (e[3] = e[3].slice(0),
            e[3][0] += t,
            e[3][1] += t),
            Gn.sector.apply(Gn, e)
        }
    }),
    _h.include({
        _paintAsPath: function() {
            return !0
        }
    }),
    Ph.include({
        arrowStyles: {
            classic: [3, 4]
        },
        _getArrowShape: function(t, e, i, n, r) {
            if (!t || !e || t.equals(e))
                return null;
            r || (r = 0);
            var o, s = i * n[0], a = i * n[1] + r, h = s / 2 + r;
            (o = e.nextCtrlPoint || e.prevCtrlPoint ? e.prevCtrlPoint ? e.sub(new dt(e.prevCtrlPoint)) : e.sub(new dt(e.nextCtrlPoint)) : e.sub(t))._unit();
            var l = e.sub(o.multi(a));
            o._perp();
            var u = l.add(o.multi(h));
            return o._multi(-1),
            [u, e, l.add(o.multi(h)), u]
        },
        _getPaintParams: function() {
            var t = this._getPrjCoordinates();
            return [this._getPath2DPoints(t, !1, this.getMap().getGLRes())]
        },
        _paintOn: function(t, e, i, n, r) {
            var o = Nd(this._painter);
            return o.within ? Gn.pixelRect(t, o.center, i, n) : this.options.smoothness ? Gn.paintSmoothLine(t, e, i, this.options.smoothness, !1, this._animIdx, this._animTailRatio) : Gn.path(t, e, i, null, r),
            this._paintArrow(t, e, i),
            this._getRenderBBOX(t, e)
        },
        _getArrowPlacement: function() {
            return this.options.arrowPlacement
        },
        _getArrowStyle: function() {
            var t = this.options.arrowStyle;
            return t ? Array.isArray(t) ? t : this.arrowStyles[t] : null
        },
        _getArrows: function(t, e, i) {
            var n = this._getArrowStyle();
            if (!n || t.length < 2)
                return [];
            for (var r = 0 < t.length && Array.isArray(t[0]) ? t : [t], o = this._getArrowPlacement(), s = [], a = this.getMap(), h = a.coordToContainerPoint(this.getFirstCoordinate()), l = a.coordToContainerPoint(this.getLastCoordinate()), u = r.length - 1; 0 <= u; u--) {
                if ("vertex-first" === o || "vertex-firstlast" === o && r[u][0].closeTo(h, .01)) {
                    var c = this._getArrowShape(r[u][1], r[u][0], e, n, i);
                    c && s.push(c)
                }
                if ("vertex-last" === o || "vertex-firstlast" === o && r[u][r[u].length - 1].closeTo(l, .01)) {
                    var d = this._getArrowShape(r[u][r[u].length - 2], r[u][r[u].length - 1], e, n, i);
                    d && s.push(d)
                } else
                    "point" === o && this._getArrowPoints(s, r[u], e, n, i)
            }
            return s
        },
        _getArrowPoints: function(t, e, i, n, r) {
            for (var o = 0, s = e.length - 1; o < s; o++) {
                var a = this._getArrowShape(e[o], e[o + 1], i, n, r);
                a && t.push(a)
            }
        },
        _paintArrow: function(t, e, i) {
            var n = this._getInternalSymbol().lineWidth;
            (!G(n) || n < 3) && (n = 3);
            var r = this._getArrows(e, n);
            if (r.length) {
                t.setLineDash && t.setLineDash([]);
                for (var o = r.length - 1; 0 <= o; o--)
                    t.fillStyle = t.strokeStyle,
                    Gn.polygon(t, r[o], i, i)
            }
        }
    }),
    yh.include({
        _getPaintParams: function(t) {
            var e = this.getMap().getGLRes()
              , i = this._getPrjShell()
              , n = this._getPath2DPoints(i, t, e)
              , r = 0 < n.length && Array.isArray(n[0]);
            r && (n = [[n[0]], [n[1]]]);
            var o = this._getPrjHoles()
              , s = [];
            if (o && 0 < o.length) {
                for (var a = this._simplified, h = 0; h < o.length; h++) {
                    var l = this._getPath2DPoints(o[h], t, e);
                    Array.isArray(l) && r ? Array.isArray(l[0]) ? (n[0].push(l[0]),
                    n[1].push(l[1])) : n[0].push(l) : s.push(l)
                }
                a && (this._simplified = a)
            }
            return r || yt(n = [n], s),
            [n]
        },
        _paintOn: function(t, e, i, n, r) {
            var o = Nd(this._painter);
            return o.within ? Gn.pixelRect(t, o.center, i, n) : Gn.polygon(t, e, i, n, r, this.options.smoothness),
            this._getRenderBBOX(t, e)
        }
    }),
    Qa.VERSION = "1.0.0-rc.33";
    var Ud = {
        Actor: Oo
    };
    t.Util = hi,
    t.DomUtil = Gi,
    t.StringUtil = Ye,
    t.MapboxUtil = Te,
    t.MicroTask = yn,
    t.Map = Qa,
    t.ui = Ou,
    t.control = Vu,
    t.renderer = Fd,
    t.symbolizer = Ns,
    t.animation = ph,
    t.worker = Ud,
    t.GlobalConfig = y,
    t.Browser = $,
    t.LRUCache = bn,
    t.Ajax = Pn,
    t.Canvas = Gn,
    t.Promise = Wi,
    t.Class = qn,
    t.Eventable = Un,
    t.GlobalEvent = Xn,
    t.JSONAble = or,
    t.CollisionIndex = br,
    t.Handlerable = Pr,
    t.Handler = Jn,
    t.DragHandler = Er,
    t.MapTool = hl,
    t.DrawTool = cl,
    t.AreaTool = su,
    t.DistanceTool = ou,
    t.SpatialReference = ia,
    t.animate = gh,
    t.registerWorkerAdapter = Qi,
    t.INTERNAL_LAYER_PREFIX = g,
    t.GEOMETRY_COLLECTION_TYPES = n,
    t.GEOJSON_TYPES = h,
    t.RESOURCE_PROPERTIES = p,
    t.RESOURCE_SIZE_PROPERTIES = m,
    t.NUMERICAL_PROPERTIES = r,
    t.COLOR_PROPERTIES = i,
    t.DEFAULT_TEXT_SIZE = s,
    t.projection = Eo,
    t.measurer = ro,
    t.Coordinate = Rr,
    t.CRS = Ar,
    t.Extent = Zr,
    t.Point = dt,
    t.PointExtent = Vr,
    t.Size = Oe,
    t.Transformation = Ur,
    t.Layer = ca,
    t.TileLayer = mc,
    t.GroupTileLayer = wc,
    t.WMSTileLayer = Mc,
    t.CanvasTileLayer = Tc,
    t.ImageLayer = Zc,
    t.OverlayLayer = nl,
    t.VectorLayer = sl,
    t.CanvasLayer = Xc,
    t.ParticleLayer = Qc,
    t.TileSystem = Uu,
    t.TileConfig = qu,
    t.ArcCurve = Zh,
    t.Circle = Fh,
    t.ConnectorLine = $h,
    t.ArcConnectorLine = tl,
    t.CubicBezierCurve = Wh,
    t.Curve = Nh,
    t.Ellipse = Gh,
    t.GeoJSON = jh,
    t.Geometry = sa,
    t.GeometryCollection = Th,
    t.Label = Yh,
    t.LineString = Ph,
    t.Marker = Ch,
    t.MultiLineString = kh,
    t.MultiPoint = Rh,
    t.MultiPolygon = Oh,
    t.Polygon = yh,
    t.QuadBezierCurve = Vh,
    t.Rectangle = Hh,
    t.Sector = Bh,
    t.TextBox = Xh,
    t.TextMarker = qh,
    Object.defineProperty(t, "__esModule", {
        value: !0
    }),
    "undefined" != typeof console && console.log && console.log("maptalks v1.0.0-rc.33")
});
